home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DJGPP / DJ111M2.ZIP / docs / djgpp / libcref.i (.txt) < prev    next >
GNU Info File  |  1994-01-08  |  229KB  |  8,495 lines

  1. This is Info file libcref.i, produced by Makeinfo-1.55 from the input
  2. file libcref.tex.
  3. This is the reference manual for libc.a
  4. Copyright (c) 1993 DJ Delorie
  5. File: libcref,  Node: Top,  Next: Introduction,  Prev: (dir),  Up: (dir)
  6. * Menu:
  7. * Introduction::
  8. * Overview::               A list of most libraries and what
  9.                            they're used for.
  10. * Functional Categories::  All public symbols listed by
  11.                            category
  12. * Alphabetical List::      All public symbols in alphabetical
  13.                            order
  14. * Index::
  15. File: libcref,  Node: Introduction,  Next: Overview,  Prev: Top,  Up: Top
  16. Introduction
  17. ************
  18. The standard C library, `libc.a', is automatically linked into your
  19. programs by the `gcc' control program.  It provides many of the
  20. functions that are normally associated with C programs.  This document
  21. gives the proper usage information about each of the functions and
  22. variables found in `libc.a'.
  23. For each function or variable that the library provides, the definition
  24. of that symbol will include information on which header files to include
  25. in your source to obtain prototypes and type definitions relevent to the
  26. use of that symbol.
  27. File: libcref,  Node: Overview,  Next: Functional Categories,  Prev: Introduction,  Up: Top
  28. Each library is of the form `libXXX.a' or `libXXX_p.a', where `XXX' is
  29. the module name.  To use a library, you must add `-lXXX' to the link
  30. line.  Only libc.a and libgcc.a are linked in by default, so if you
  31. want to use any of the other libraries you must give them explicitely.
  32. Libraries with the `_p' were compiled with the `-pg' switch, and will
  33. be used when you link with that switch.  This allows the profiler to
  34. obtain information about library functions as well as your modules.
  35. `libbison.a'
  36.      This library has default functions for Bison programs.  Use this
  37.      if you use only the .y file to define your program.
  38. `libc.a'
  39. `libc_p.a'
  40.      This is the standard C library.
  41. `libflex.a'
  42. `libflex_.a'
  43.      This library has default functions for Flex programs.  Use this if
  44.      you use only the .l file to define your program.
  45. `libg.a'
  46. `libg_p.a'
  47.      This is an empty library that the compiler sometimes includes in
  48.      your link.
  49. `libgcc.a'
  50. `libgcc_p.a'
  51.      This library has helper functions that gcc sometimes links into
  52.      your program for runtime support.
  53. `libgpl.a'
  54. `libgpl_p.a'
  55.      This library has a few routines that are protected by the GPL.
  56.      *Warning!* Use of this library in your program may alter the
  57.      copyright status of your program.
  58. `libgpp.a'
  59.      C++ support library.  You must link this for most C++ programs by
  60.      giving "-lgpp" on the link line.
  61.      *Warning!* Use of this library in your program may alter the
  62.      copyright status of your program.
  63. `libgr.a'
  64. `libgr_p.a'
  65.      Simple, 256-color only graphics routines.  The GRX module has a
  66.      more complete graphics library.
  67. `libm.a'
  68. `libm_p.a'
  69.      Various math routines.  If you use `<math.h>', chances are you'll
  70.      need this also.  Some classes in `libgplus.a' also require this, so
  71.      you'll need `-lgplus -lm' in that case.
  72. `libobjc.a'
  73.      Objective-C modules.  You'll need to add `-lobjc' to your link to
  74.      use these.
  75. `libpc.a'
  76. `libpc_p.a'
  77.      Some routines found in `<pc.h>', including conio, screen, and sound
  78.      routines.
  79. File: libcref,  Node: Functional Categories,  Next: Alphabetical List,  Prev: Overview,  Up: Top
  80. Functional Categories
  81. *********************
  82. Not done yet. *Note Alphabetical List::
  83. File: libcref,  Node: Alphabetical List,  Prev: Functional Categories,  Up: Top
  84. Alphabetical List
  85. *****************
  86. * Menu:
  87. * abort::
  88. * abs::
  89. * access::
  90. * addmntent::
  91. * asctime::
  92. * __atexit::
  93. * atexit::
  94. * atof::
  95. * atoi::
  96. * atol::
  97. * bcmp::
  98. * _bcopy::
  99. * bcopy::
  100. * bdos::
  101. * bdosptr::
  102. * biosequip::
  103. * bioskey::
  104. * biosmemory::
  105. * biosprint::
  106. * brk::
  107. * bsearch::
  108. * bzero::
  109. * calloc::
  110. * cfree::
  111. * chdir::
  112. * chmod::
  113. * chown::
  114. * _cleanup::
  115. * clearerr::
  116. * clock::
  117. * close::
  118. * closedir::
  119. * creat::
  120. * crlf2nl::
  121. * ctime::
  122. * _ctype_::
  123. * delay::
  124. * difftime::
  125. * disable::
  126. * div::
  127. * _doprnt::
  128. * _doscan::
  129. * _doscan_low::
  130. * dosmemget::
  131. * dosmemput::
  132. * dup::
  133. * dup2::
  134. * enable::
  135. * endgrent::
  136. * endmntent::
  137. * endpwent::
  138. * errno::
  139. * exec*::
  140. * _exit::
  141. * exit::
  142. * _f_morefiles::
  143. * fchmod::
  144. * fclose::
  145. * fdopen::
  146. * feof::
  147. * ferror::
  148. * fflush::
  149. * ffs::
  150. * fgetc::
  151. * fgetgrent::
  152. * fgetpos::
  153. * fgetpwent::
  154. * fgets::
  155. * _filbuf::
  156. * fileno::
  157. * _findenv::
  158. * findfirst::
  159. * _findiop::
  160. * findnext::
  161. * _fixpath::
  162. * _flsbuf::
  163. * _fmode::
  164. * fnmatch::
  165. * fnmerge::
  166. * fnsplit::
  167. * fopen::
  168. * fork::
  169. * fpathconf::
  170. * fprintf::
  171. * fpurge::
  172. * fputc::
  173. * fputs::
  174. * fread::
  175. * free::
  176. * freopen::
  177. * fscanf::
  178. * fseek::
  179. * fsetpos::
  180. * fstat::
  181. * fsync::
  182. * ftell::
  183. * ftime::
  184. * ftruncate::
  185. * _fwalk::
  186. * fwrite::
  187. * _get_default_drive::
  188. * getc::
  189. * getcbrk::
  190. * getchar::
  191. * getcwd::
  192. * getdate::
  193. * getdfree::
  194. * getdisk::
  195. * getdtablesize::
  196. * getegid::
  197. * getenv::
  198. * geteuid::
  199. * getftime::
  200. * getgid::
  201. * getgrent::
  202. * getgrgid::
  203. * getgrnam::
  204. * getgroups::
  205. * getkey::
  206. * getlogin::
  207. * getlongpass::
  208. * getmntent::
  209. * getopt::
  210. * getpagesize::
  211. * getpass::
  212. * getpid::
  213. * getpwent::
  214. * getpwnam::
  215. * getpwuid::
  216. * getrusage::
  217. * gets::
  218. * gettime::
  219. * gettimeofday::
  220. * getuid::
  221. * getw::
  222. * getwd::
  223. * getxkey::
  224. * gmtime::
  225. * _go32_conventional_mem_selector::
  226. * Go32/DPMI Information::
  227. * _go32_dpmi_allocate_dos_memory::
  228. * _go32_dpmi_allocate_iret_wrapper::
  229. * _go32_dpmi_allocate_real_mode_callback_iret::
  230. * _go32_dpmi_allocate_real_mode_callback_retf::
  231. * _go32_dpmi_chain_protected_mode_interrupt_vector::
  232. * _go32_dpmi_free_dos_memory::
  233. * _go32_dpmi_free_iret_wrapper::
  234. * _go32_dpmi_free_real_mode_callback::
  235. * _go32_dpmi_get_free_memory_information::
  236. * _go32_dpmi_get_protected_mode_interrupt_vector::
  237. * _go32_dpmi_get_real_mode_interrupt_vector::
  238. * _go32_dpmi_remaining_physical_memory::
  239. * _go32_dpmi_remaining_virtual_memory::
  240. * _go32_dpmi_resize_dos_memory::
  241. * _go32_dpmi_set_protected_mode_interrupt_vector::
  242. * _go32_dpmi_set_real_mode_interrupt_vector::
  243. * _go32_dpmi_simulate_fcall::
  244. * _go32_dpmi_simulate_fcall_iret::
  245. * _go32_dpmi_simulate_int::
  246. * _go32_info_block::
  247. * _go32_my_cs::
  248. * _go32_my_ds::
  249. * _go32_my_ss::
  250. * _go32_want_ctrl_break::
  251. * _go32_was_ctrl_break_hit::
  252. * hasmntopt::
  253. * htonl::
  254. * htons::
  255. * index::
  256. * initstate::
  257. * insque::
  258. * int86::
  259. * int86x::
  260. * intdos::
  261. * intdosx::
  262. * _iob::
  263. * isalnum::
  264. * isalpha::
  265. * isatty::
  266. * iscntrl::
  267. * isdigit::
  268. * isgraph::
  269. * islower::
  270. * isprint::
  271. * ispunct::
  272. * isspace::
  273. * isupper::
  274. * isxdigit::
  275. * kbhit::
  276. * kill::
  277. * labs::
  278. * ldexp::
  279. * ldiv::
  280. * link::
  281. * localtime::
  282. * lock::
  283. * longjmp::
  284. * longjmperror::
  285. * lseek::
  286. * __main::
  287. * malloc::
  288. * memccpy::
  289. * memchr::
  290. * memcmp::
  291. * _memcpy::
  292. * memcpy::
  293. * memmove::
  294. * memset::
  295. * mkdir::
  296. * mkfifo::
  297. * mknod::
  298. * mkstemp::
  299. * mktemp::
  300. * mktime::
  301. * modf::
  302. * morecore::
  303. * movedata::
  304. * nlist::
  305. * ntohl::
  306. * ntohs::
  307. * on_exit::
  308. * open::
  309. * opendir::
  310. * optarg::
  311. * opterr::
  312. * optind::
  313. * optopt::
  314. * pathconf::
  315. * pclose::
  316. * perror::
  317. * pipe::
  318. * popen::
  319. * printf::
  320. * putc::
  321. * putchar::
  322. * putenv::
  323. * puts::
  324. * putw::
  325. * qsort::
  326. * rand::
  327. * random::
  328. * rawclock::
  329. * read::
  330. * readcr::
  331. * readdir::
  332. * readv::
  333. * realloc::
  334. * realloc_srchlen::
  335. * remove::
  336. * remque::
  337. * rename::
  338. * rewind::
  339. * rewinddir::
  340. * rindex::
  341. * rmdir::
  342. * sbrk::
  343. * scanf::
  344. * seekdir::
  345. * setbuf::
  346. * setbuffer::
  347. * setcbrk::
  348. * setdate::
  349. * setdisk::
  350. * setenv::
  351. * setftime::
  352. * setgrent::
  353. * setjmp::
  354. * setlinebuf::
  355. * setmntent::
  356. * _setmode::
  357. * setmode::
  358. * setpwent::
  359. * _setstack::
  360. * setstate::
  361. * settime::
  362. * settimeofday::
  363. * setvbuf::
  364. * sigaction::
  365. * sigaddset::
  366. * sigdelset::
  367. * sigemptyset::
  368. * sigfillset::
  369. * sigismember::
  370. * signal::
  371. * sigsetmask::
  372. * sleep::
  373. * _smallbuf::
  374. * spawn*::
  375. * sprintf::
  376. * srand::
  377. * srandom::
  378. * sscanf::
  379. * stat::
  380. * stat_assist::
  381. * statfs::
  382. * _stklen::
  383. * strcasecmp::
  384. * strcat::
  385. * strchr::
  386. * strcmp::
  387. * strcoll::
  388. * strcpy::
  389. * strcspn::
  390. * strdup::
  391. * strerror::
  392. * strftime::
  393. * stricmp::
  394. * strlen::
  395. * strlwr::
  396. * strncasecmp::
  397. * strncat::
  398. * strncmp::
  399. * strncpy::
  400. * strnicmp::
  401. * strpbrk::
  402. * strrchr::
  403. * strsep::
  404. * strspn::
  405. * strstr::
  406. * strtod::
  407. * strtok::
  408. * strtol::
  409. * strtoul::
  410. * strupr::
  411. * strxfrm::
  412. * swab::
  413. * sync::
  414. * sys_errlist::
  415. * sys_nerr::
  416. * sysconf::
  417. * system::
  418. * tell::
  419. * telldir::
  420. * tempnam::
  421. * time::
  422. * timezone::
  423. * tmpfile::
  424. * tmpnam::
  425. * tolower::
  426. * toupper::
  427. * truncate::
  428. * ttyname::
  429. * tzname::
  430. * tzset::
  431. * tzsetwall::
  432. * _tztab::
  433. * umask::
  434. * ungetc::
  435. * unlink::
  436. * unlock::
  437. * unsetenv::
  438. * usleep::
  439. * utime::
  440. * utimes::
  441. * valloc::
  442. * vfork::
  443. * vfprintf::
  444. * vprintf::
  445. * vsprintf::
  446. * wait::
  447. * write::
  448. * writecr::
  449. * writev::
  450. * xmalloc::
  451. * xrealloc::
  452. File: libcref,  Node: abort,  Next: abs,  Up: Alphabetical List
  453. `abort'
  454. =======
  455. Syntax
  456. ------
  457.      #include <stdlib.h>
  458.      
  459.      void volatile abort(void);
  460. Description
  461. -----------
  462. When you call `abort', the message "Abort!" is printed on stdout and
  463. the program exits with an exit code of one.
  464. Return Value
  465. ------------
  466. This function does not return.
  467. Example
  468. -------
  469.      if ((q = malloc(100)) == NULL)
  470.        abort();
  471. File: libcref,  Node: abs,  Next: access,  Prev: abort,  Up: Alphabetical List
  472. `abs'
  473. =====
  474. Syntax
  475. ------
  476.      #include <stdlib.h>
  477.      
  478.      int abs(int value);
  479. Return Value
  480. ------------
  481. The absolute value of `value' is returned.
  482. Example
  483. -------
  484.      int sq = 7;
  485.      sq = sq * abs(sq) + 1;
  486. File: libcref,  Node: access,  Next: addmntent,  Prev: abs,  Up: Alphabetical List
  487. `access'
  488. ========
  489. Syntax
  490. ------
  491.      #include <unistd.h>
  492.      
  493.      int access(const char *filename, int flags);
  494. Description
  495. -----------
  496. This function determines what kind of access modes a given file allows.
  497. The parameter FLAGS is the logical `or' of one or more of the following
  498. flags:
  499. `R_OK'
  500.      Request if the file is readable.  Since all files are readable
  501.      under MS-DOS, this access mode always exists.
  502. `W_OK'
  503.      Request if the file is writable.
  504. `X_OK'
  505.      Request if the file is executable.  This flag currently has no
  506.      affect.
  507. `F_OK'
  508.      Request if the file exists.
  509. Return Value
  510. ------------
  511. Zero if the requested access mode is allowed, nonzero if not.
  512. Example
  513. -------
  514.      if (access("file.ext", W_OK))
  515.        return ERROR_CANNOT_WRITE;
  516.      open("file.ext", O_RDWR);
  517. File: libcref,  Node: addmntent,  Next: asctime,  Prev: access,  Up: Alphabetical List
  518. `addmntent'
  519. ===========
  520. Syntax
  521. ------
  522.      #include <mntent.h>
  523.      
  524.      int addmntent(FILE *filep, struct mntent *mnt);
  525. Description
  526. -----------
  527. This function is a no-op for MS-DOS, but is provided to assist in Unix
  528. ports.  *Note getmntent::
  529. Return Value
  530. ------------
  531. This function always returns nonzero to signify an error.
  532. File: libcref,  Node: asctime,  Next: __atexit,  Prev: addmntent,  Up: Alphabetical List
  533. `asctime'
  534. =========
  535. Syntax
  536. ------
  537.      #include <time.h>
  538.      
  539.      char *asctime(const struct tm *tptr);
  540. Description
  541. -----------
  542. This function returns an ASCII representation of the time represented by
  543. TPTR.  The string returned is always 26 characters and has this format:
  544.      Sun Jan 01 12:34:56 1993\n\0
  545. The string pointed to is in a static buffer and will be overridden with
  546. each call to asctime.  The data should be copied if it needs to be
  547. preserved.
  548. Return Value
  549. ------------
  550. A pointer to the string.
  551. Example
  552. -------
  553.      time_t now;
  554.      time(&now);
  555.      printf("The current time is %s", asctime(localtime(&now)));
  556. File: libcref,  Node: __atexit,  Next: atexit,  Prev: asctime,  Up: Alphabetical List
  557. `__atexit'
  558. ==========
  559. Description
  560. -----------
  561. This is an internal variable used by `atexit' (*Note atexit::) and
  562. `on_exit' (*Note on_exit::).
  563. File: libcref,  Node: atexit,  Next: atof,  Prev: __atexit,  Up: Alphabetical List
  564. `atexit'
  565. ========
  566. Syntax
  567. ------
  568.      #include <stdlib.h>
  569.      
  570.      int atexit(void (*func)(void));
  571. Description
  572. -----------
  573. This function places the specified function FUNC on a list of functions
  574. to be called when `exit' is called.  These functions are called as if a
  575. last-in-first-out queue is used, that is, the last function registered
  576. with `atexit' will be the first function called by `exit'.
  577. At least 32 functions can be registered this way.
  578. Return Value
  579. ------------
  580. Zero on success, non-zero on error.
  581. Example
  582. -------
  583.      void exit_func()
  584.      {
  585.        remove("file.tmp");
  586.      }
  587.      
  588.      ...
  589.      atexit(exit_func);
  590.      ...
  591. File: libcref,  Node: atof,  Next: atoi,  Prev: atexit,  Up: Alphabetical List
  592. `atof'
  593. ======
  594. Syntax
  595. ------
  596.      #include <stdlib.h>
  597.      
  598.      double atof(const char *string);
  599. Description
  600. -----------
  601. Convert as much of the string as possible to an equivalent double
  602. precision real number.
  603. This function is almost like `strtod(string, NULL)' (*Note strtod::).
  604. Return Value
  605. ------------
  606. The equivalent value, or zero if the string does not represent a number.
  607. Example
  608. -------
  609.      main(int argc, char **argv)
  610.      {
  611.        double d = atof(argv[1]);
  612.        ...
  613. File: libcref,  Node: atoi,  Next: atol,  Prev: atof,  Up: Alphabetical List
  614. `atoi'
  615. ======
  616. Syntax
  617. ------
  618.      #include <stdlib.h>
  619.      
  620.      int atoi(const char *string);
  621. Description
  622. -----------
  623. Convert as much of the string as possible to an equivalent integer
  624. value.
  625. This function is almost like `(int)strtol(string, NULL, 10)' (*Note
  626. strtol::).
  627. Return Value
  628. ------------
  629. The equivalent value, or zero if the string does not represent a number.
  630. Example
  631. -------
  632.      main(int argc, char **argv)
  633.      {
  634.        int i = atoi(argv[1]);
  635.        ...
  636. File: libcref,  Node: atol,  Next: bcmp,  Prev: atoi,  Up: Alphabetical List
  637. `atol'
  638. ======
  639. Syntax
  640. ------
  641.      #include <stdlib.h>
  642.      
  643.      long atol(const char *string);
  644. Description
  645. -----------
  646. Convert as much of the string as possible to an equivalent long integer
  647. value.
  648. This function is almost like `strtol(string, NULL, 10)' (*Note
  649. strtol::).
  650. Return Value
  651. ------------
  652. The equivalent value, or zero if the string does not represent a number.
  653. Example
  654. -------
  655.      main(int argc, char **argv)
  656.      {
  657.        long l = atol(argv[1]);
  658.        ...
  659. File: libcref,  Node: bcmp,  Next: _bcopy,  Prev: atol,  Up: Alphabetical List
  660. `bcmp'
  661. ======
  662. Syntax
  663. ------
  664.      #include <string.h>
  665.      
  666.      int bcmp(const void *ptr1, const void *ptr2, int length);
  667. Description
  668. -----------
  669. Compare memory pointed to by PTR1 and PTR2 for at most LENGTH bytes.
  670. Return Value
  671. ------------
  672. The number of bytes remaining when the first mismatch occurred, or zero
  673. if all bytes were equal.
  674. Example
  675. -------
  676.      void f(char *s1, char *s2)
  677.      {
  678.        int l = bcmp(s1, s2, strlen(s1));
  679.        printf("Difference: %s, %s\n", s1+strlen(s1)-l, s2+strlen(s1)-l);
  680.      }
  681. File: libcref,  Node: _bcopy,  Next: bcopy,  Prev: bcmp,  Up: Alphabetical List
  682. `_bcopy'
  683. ========
  684. Syntax
  685. ------
  686.      #include <string.h>
  687.      
  688.      void _bcopy(const void *source, void *dest, int length);
  689. Description
  690. -----------
  691. Copy LENGTH bytes from SOURCE to DEST.  This is just like `bcopy'
  692. (*Note bcopy::), except that the loads and stores are done with
  693. different opcodes in case SOURCE and DEST can't be paged in at the same
  694. time (like blitting in the graphics buffer).
  695. Return Value
  696. ------------
  697. No value is returned.
  698. Example
  699. -------
  700.      bcopy(ScreenPrimary+ScreenCols()*2, ScreenPrimary,
  701.        (ScreenRows()-1)*ScreenCols()*2);
  702. File: libcref,  Node: bcopy,  Next: bdos,  Prev: _bcopy,  Up: Alphabetical List
  703. `bcopy'
  704. =======
  705. Syntax
  706. ------
  707.      #include <string.h>
  708.      
  709.      void bcopy(const void *source, void *dest, int length);
  710. Description
  711. -----------
  712. Copy LENGTH bytes from SOURCE to DEST.  Overlapping regions are handled
  713. properly, although this behavior is not portable.
  714. Return Value
  715. ------------
  716. No value is returned.
  717. Example
  718. -------
  719.      struct s a, b;
  720.      bcopy(a, b, sizeof(struct s));
  721. File: libcref,  Node: bdos,  Next: bdosptr,  Prev: bcopy,  Up: Alphabetical List
  722. `bdos'
  723. ======
  724. Syntax
  725. ------
  726.      #include <dos.h>
  727.      
  728.      int bdos(int func, unsigned edx, unsigned al);
  729. Description
  730. -----------
  731. Performs a software interrupt type 0x21, passing %al and %edx as
  732. specified, with FUNC in %ah.
  733. Return Value
  734. ------------
  735. %eax is returned.
  736. Example
  737. -------
  738.      /* read a character */
  739.      int ch = bdos(1, 0, 0) & 0xff;
  740. File: libcref,  Node: bdosptr,  Next: biosequip,  Prev: bdos,  Up: Alphabetical List
  741. `bdosptr'
  742. =========
  743. Syntax
  744. ------
  745.      #include <dos.h>
  746.      
  747.      int bdosptr(int func, void *edx, unsigned al);
  748. Description
  749. -----------
  750. Performs a software interrupt type 0x21, passing %al and %edx as
  751. specified, with FUNC in %ah.
  752. Return Value
  753. ------------
  754. %eax is returned.
  755. Example
  756. -------
  757.      /* print a string */
  758.      bdos(9, "Hello, there$", 0);
  759. File: libcref,  Node: biosequip,  Next: bioskey,  Prev: bdosptr,  Up: Alphabetical List
  760. `biosequip'
  761. ===========
  762. Syntax
  763. ------
  764.      #include <bios.h>
  765.      
  766.      int biosequip(void);
  767. Description
  768. -----------
  769. This function returns the equipment word from BIOS request 0x11.  The
  770. bits correspond to the following values:
  771.      1111 1100 0000 0000
  772.      5432 1098 7654 3210  Meaning
  773.      
  774.      ---- ---- ---- ---X  1 = disk drive(s) installed
  775.      ---- ---- ---- --X-  1 = math coprocessor installed
  776.      ---- ---- ---- XX--  System memory 00=16k 01=32k 10=48k 11=64k (non PS/2)
  777.      ---- ---- ---- -X--  1 = pointing device installed (PS/2)
  778.      ---- ---- ---- X---  not used on PS/2
  779.      ---- ---- --XX ----  initial video mode: 01=CO40 10=CO80 11=MONO
  780.      ---- ---- XX-- ----  disk drives 00=1 01=2 10=3 11=4 (zero if bit 1=0)
  781.      ---- ---X ---- ----  1 = no DMA available
  782.      ---- XXX- ---- ----  number of serial ports installed (000=0 001=1 etc)
  783.      ---X ---- ---- ----  1 = game port adapter installed
  784.      --X- ---- ---- ----  1 = internal modem installed (PS/2)
  785.      --X- ---- ---- ----  1 = serial printer attached (non PS/2)
  786.      XX-- ---- ---- ----  number of printers installed (00=0 01=1 10=2 11=3)
  787. Return Value
  788. ------------
  789. The equipment word.
  790. Example
  791. -------
  792.      if (biosequip() & 0xc000)
  793.        do_printing();
  794. File: libcref,  Node: bioskey,  Next: biosmemory,  Prev: biosequip,  Up: Alphabetical List
  795. `bioskey'
  796. =========
  797. Syntax
  798. ------
  799.      #include <bios.h>
  800.      
  801.      int bioskey(int command)
  802. Description
  803. -----------
  804. COMMAND = 0
  805.      Returns the next key pressed
  806. COMMAND = 1
  807.      Checks the keyboard, returns zero if no key pressed, else the key.
  808.      Does not dequeue the key.
  809. COMMAND = 2
  810.      Returns the shift state:
  811.           7654 3210  Meaning
  812.           
  813.           ---- ---X  Right shift key down
  814.           ---- --X-  Left shift key down
  815.           ---- -X--  Ctrl key down
  816.           ---- X---  Alt key down
  817.           ---X ----  Scroll lock on
  818.           --X- ----  Num lock on
  819.           -X-- ----  Caps lock on
  820.           X--- ----  Insert on
  821. Return Value
  822. ------------
  823. Depends on COMMAND.
  824. Example
  825. -------
  826.      while (!bioskey(1))
  827.        do_stuff();
  828. File: libcref,  Node: biosmemory,  Next: biosprint,  Prev: bioskey,  Up: Alphabetical List
  829. `biosmemory'
  830. ============
  831. Syntax
  832. ------
  833.      #include <bios.h>
  834.      
  835.      unsigned biosmemory(void);
  836. Description
  837. -----------
  838. This function returns the amount of system memory in 1k blocks.
  839. Note that this function will return 65535 if the system has more than
  840. 64M of memory.  This is a limitation of the BIOS.
  841. Return Value
  842. ------------
  843. Bytes of memory / 1024.
  844. Example
  845. -------
  846.      printf("This system has %d bytes of memory\n", biosmemory()/1024);
  847. File: libcref,  Node: biosprint,  Next: brk,  Prev: biosmemory,  Up: Alphabetical List
  848. `biosprint'
  849. ===========
  850. Syntax
  851. ------
  852.      #include <stdio.h>
  853.      
  854.      int biosprint(int cmd, int byte, int port)
  855. Description
  856. -----------
  857. COMMAND = 0
  858.      `byte' is sent to parallel port PORT.
  859. COMMAND = 1
  860.      Parallel port PORT is reset and initialized.
  861. COMMAND = 2
  862.      The status of parallel port PORT is returned.
  863.           7654 3210  Meaning
  864.           
  865.           ---- ---X  Timeout
  866.           ---- -XX-  Unused
  867.           ---- X---  I/O Error
  868.           ---X ----  Selected
  869.           --X- ----  Out of paper
  870.           -X-- ----  Acknowledged
  871.           X--- ----  Idle
  872. Return Value
  873. ------------
  874. The printer status.
  875. Example
  876. -------
  877.      while (*c)
  878.        biosprint(0, 0, *c++);
  879. File: libcref,  Node: brk,  Next: bsearch,  Prev: biosprint,  Up: Alphabetical List
  880. `brk'
  881. =====
  882. Syntax
  883. ------
  884.      #include <stdlib.h>
  885.      
  886.      int brk(void *ptr);
  887. Description
  888. -----------
  889. This function changes the *break* for the program.  This is the first
  890. address that, if referenced, will cause a fault to occur.  The program
  891. asks for more memory by specifying larger values for PTR.  Normally,
  892. this is done transparently through the `malloc' function.
  893. Return Value
  894. ------------
  895. zero if the break was changed, -1 if not.  ERRNO is set to the error.
  896. Example
  897. -------
  898.      if (brk(old_brk+1000))
  899.        printf("no memory\n");
  900. File: libcref,  Node: bsearch,  Next: bzero,  Prev: brk,  Up: Alphabetical List
  901. `bsearch'
  902. =========
  903. Syntax
  904. ------
  905.      #include <stdlib.h>
  906.      
  907.      void *bsearch (const void *key, const void *base, size_t num,
  908.        size_t size, int (*ptf)(const void *ckey, const void *celem));
  909. Description
  910. -----------
  911. Given an array of values, perform a binary search on the values looking
  912. for value that "matches" the given key.  A match is determined by
  913. calling the provided function PTF and passing it the key as CKEY and a
  914. pointer to one of the elements of the array as CELEM.  This function
  915. must return a negative number if the key is closer than the element to
  916. the beginning of the array, positive if it is closer to the end, and
  917. zero if the element matches the key.
  918. The array begins at address BASE and contains NUM elements, each of
  919. size SIZE.
  920. Return Value
  921. ------------
  922. Returns a pointer to the element that matches the key, else NULL.
  923. Example
  924. -------
  925.      typedef struct {
  926.        int a, b;
  927.      } q;
  928.      
  929.      int compare(void *key, void *elem)
  930.      {
  931.        return *(int *)key - ((q *)elem)->a;
  932.      }
  933.      
  934.      q qlist[100];
  935.      
  936.      ...
  937.      q *match = bsearch(4, qlist, 100, sizeof(q), compare);
  938.      printf("4->%d=n", match->b);
  939.      ...
  940. File: libcref,  Node: bzero,  Next: calloc,  Prev: bsearch,  Up: Alphabetical List
  941. `bzero'
  942. =======
  943. Syntax
  944. ------
  945.      #include <string.h>
  946.      
  947.      void bzero(void *pointer, int length);
  948. Description
  949. -----------
  950. The data at POINTER is filled with LENGTH zeros.
  951. Return Value
  952. ------------
  953. None.
  954. Example
  955. -------
  956.      char foo[100];
  957.      bzero(foo,100);
  958. File: libcref,  Node: calloc,  Next: cfree,  Prev: bzero,  Up: Alphabetical List
  959. `calloc'
  960. ========
  961. Syntax
  962. ------
  963.      #include <malloc.h>
  964.      
  965.      void *calloc(size_t num_elements, size_t size);
  966. Description
  967. -----------
  968. This function allocates enough memory for NUM_ELEMENTS objects of size
  969. SIZE.  The memory returned is initialized to all zeros.  The pointer
  970. returned should later be passed to cfree (*Note cfree::) so that the
  971. memory can be returned to the heap.
  972. Return Value
  973. ------------
  974. A pointer to the memory, or `NULL' if no more memory is available.
  975. Example
  976. -------
  977.      Complex *x = calloc(12, sizeof(Complex));
  978.      cfree(x);
  979. File: libcref,  Node: cfree,  Next: chdir,  Prev: calloc,  Up: Alphabetical List
  980. `cfree'
  981. =======
  982. Syntax
  983. ------
  984.      #include <malloc.h>
  985.      
  986.      void cfree(void *pointer);
  987. Description
  988. -----------
  989. This function returns the memory allocated by calloc (*Note calloc::) to
  990. the heap.
  991. Return Value
  992. ------------
  993. None.
  994. Example
  995. -------
  996.      Complex *x = calloc(12, sizeof(Complex));
  997.      cfree(x);
  998. File: libcref,  Node: chdir,  Next: chmod,  Prev: cfree,  Up: Alphabetical List
  999. `chdir'
  1000. =======
  1001. Syntax
  1002. ------
  1003.      #include <osfcn.h>
  1004.      
  1005.      int chdir(const char *new_directory);
  1006. Description
  1007. -----------
  1008. This function changes the current directory to NEW_DIRECTORY.  If a
  1009. drive letter is specified, the current directory for that drive is
  1010. changed, else the current drive is changed.
  1011. Return Value
  1012. ------------
  1013. Zero if the new directory exists, else nonzero and ERRNO set if error.
  1014. Example
  1015. -------
  1016.      if (chdir("/tmp"))
  1017.        perror("/tmp");
  1018. File: libcref,  Node: chmod,  Next: chown,  Prev: chdir,  Up: Alphabetical List
  1019. `chmod'
  1020. =======
  1021. Syntax
  1022. ------
  1023.      #include <osfcn.h>
  1024.      
  1025.      int chmod(const char *filename, int mode);
  1026. Description
  1027. -----------
  1028. This function changes the mode (writable or write-only) of the specified
  1029. file.  The value of MODE can be a combination of one or more of the
  1030. following:
  1031. `S_IREAD'
  1032.      Make the file readable
  1033. `S_IWRITE'
  1034.      Make the file writable
  1035. Return Value
  1036. ------------
  1037. Zero if the file exists and the mode was changed, else nonzero.
  1038. Example
  1039. -------
  1040.      chmod("/tmp/dj.dat", S_IWRITE|S_IREAD);
  1041. File: libcref,  Node: chown,  Next: _cleanup,  Prev: chmod,  Up: Alphabetical List
  1042. `chown'
  1043. =======
  1044. Syntax
  1045. ------
  1046.      #include <osfcn.h>
  1047.      
  1048.      int chown(const char *file, int owner, int group);
  1049. Description
  1050. -----------
  1051. This function does nothing under MS-DOS
  1052. Return Value
  1053. ------------
  1054. This function always returns zero.
  1055. File: libcref,  Node: _cleanup,  Next: clearerr,  Prev: chown,  Up: Alphabetical List
  1056. `_cleanup'
  1057. ==========
  1058. Description
  1059. -----------
  1060. This is an internal function used to clean up file descriptors when the
  1061. program calls `exit'.
  1062. File: libcref,  Node: clearerr,  Next: clock,  Prev: _cleanup,  Up: Alphabetical List
  1063. `clearerr'
  1064. ==========
  1065. Syntax
  1066. ------
  1067.      #include <stdio.h>
  1068.      
  1069.      void clearerr(FILE *stream);
  1070. Description
  1071. -----------
  1072. This function clears the EOF and error indicators for the file STREAM.
  1073. Return Value
  1074. ------------
  1075. None.
  1076. Example
  1077. -------
  1078.      clearerr(stdout);
  1079. File: libcref,  Node: clock,  Next: close,  Prev: clearerr,  Up: Alphabetical List
  1080. `clock'
  1081. =======
  1082. Syntax
  1083. ------
  1084.      #include <time.h>
  1085.      
  1086.      clock_t clock(void);
  1087. Description
  1088. -----------
  1089. This function returns the number of clock ticks since an arbitrary time,
  1090. actually, since the first call to `clock', which itself returns zero.
  1091. The number of tics per second is CLOCKS_PER_SEC.
  1092. Return Value
  1093. ------------
  1094. The number of tics.
  1095. Example
  1096. -------
  1097.      printf("%d seconds have elapsed\n", clock()/CLOCKS_PER_SEC);
  1098. File: libcref,  Node: close,  Next: closedir,  Prev: clock,  Up: Alphabetical List
  1099. `close'
  1100. =======
  1101. Syntax
  1102. ------
  1103.      #include <osfcn.h>
  1104.      
  1105.      int close(int fd);
  1106. Description
  1107. -----------
  1108. The open file associated with FD is closed.
  1109. Return Value
  1110. ------------
  1111. Zero if the file was closed, nonzero if FD was invalid or already
  1112. closed.
  1113. Example
  1114. -------
  1115.      int fd = open("data", O_RDONLY);
  1116.      close(fd);
  1117. File: libcref,  Node: closedir,  Next: creat,  Prev: close,  Up: Alphabetical List
  1118. `closedir'
  1119. ==========
  1120. Syntax
  1121. ------
  1122.      #include <dirent.h>
  1123.      
  1124.      int closedir(DIR *dir);
  1125. Description
  1126. -----------
  1127. This function closes a directory opened by opendir (*Note opendir::).
  1128. Return Value
  1129. ------------
  1130. Zero on success, nonzero if DIR is invalid.
  1131. File: libcref,  Node: creat,  Next: crlf2nl,  Prev: closedir,  Up: Alphabetical List
  1132. `creat'
  1133. =======
  1134. Syntax
  1135. ------
  1136.      #include <osfcn.h>
  1137.      #include <sys/stat.h>
  1138.      
  1139.      int creat(const char *filename, unsigned long int mode);
  1140. Description
  1141. -----------
  1142. This function creates the given file and opens it for writing.  If the
  1143. file exists, it is truncated to zero size, unless it is read-only, in
  1144. which case the function fails.  If the file does not exist, it will be
  1145. created read-only if MODE does not have `S_IWRITE' set.
  1146. Return Value
  1147. ------------
  1148. A file descriptor >= 0, or a negative number on error.
  1149. Example
  1150. -------
  1151.      int fd = creat("data", S_IWRITE);
  1152.      write(fd, buf, 1024);
  1153.      close(fd);
  1154. File: libcref,  Node: crlf2nl,  Next: ctime,  Prev: creat,  Up: Alphabetical List
  1155. `crlf2nl'
  1156. =========
  1157. Syntax
  1158. ------
  1159.      unsigned crlf2nl(char *buf, unsigned len);
  1160. Description
  1161. -----------
  1162. This function removes Ctrl-M characters from the given BUF.
  1163. Return Value
  1164. ------------
  1165. The number of characters remaining in the buffer are returned.
  1166. File: libcref,  Node: ctime,  Next: _ctype_,  Prev: crlf2nl,  Up: Alphabetical List
  1167. `ctime'
  1168. =======
  1169. Syntax
  1170. ------
  1171.      #include <time.h>
  1172.      
  1173.      char *ctime(const time_t *cal);
  1174. Description
  1175. -----------
  1176. This function returns an ASCII representation of the time in CAL.  This
  1177. is equivalent to `asctime(localtime(cal))'.  *Note asctime:: *Note
  1178. localtime::
  1179. Return Value
  1180. ------------
  1181. The ascii representation of the time.
  1182. File: libcref,  Node: _ctype_,  Next: delay,  Prev: ctime,  Up: Alphabetical List
  1183. `_ctype_'
  1184. =========
  1185. Syntax
  1186. ------
  1187.      #include <ctype.h>
  1188.      
  1189.      extern char _ctype_[257];
  1190. Description
  1191. -----------
  1192. This is an array used by the functions and macros in `<ctype.h>'.
  1193. File: libcref,  Node: delay,  Next: difftime,  Prev: _ctype_,  Up: Alphabetical List
  1194. `delay'
  1195. =======
  1196. Syntax
  1197. ------
  1198.      void delay(unsigned msec);
  1199. Description
  1200. -----------
  1201. This function causes the program to pause for MSEC milliseconds.  It
  1202. uses the `int 15h' delay function to relinquish the CPU to other
  1203. programs that might need it.
  1204. Return Value
  1205. ------------
  1206. None.
  1207. Example
  1208. -------
  1209.      delay(200); /* delay for 1/5 second */
  1210. File: libcref,  Node: difftime,  Next: disable,  Prev: delay,  Up: Alphabetical List
  1211. `difftime'
  1212. ==========
  1213. Syntax
  1214. ------
  1215.      #include <time.h>
  1216.      
  1217.      double difftime(time_t t1, time_t t0);
  1218. Description
  1219. -----------
  1220. This function returns the difference in time, in seconds, from T0 to T1.
  1221. Return Value
  1222. ------------
  1223. The number of seconds.
  1224. Example
  1225. -------
  1226.      time_t t1, t0;
  1227.      double elapsed;
  1228.      time(&t0);
  1229.      do_something();
  1230.      time(&t1);
  1231.      elapsed = difftime(t1, t0);
  1232. File: libcref,  Node: disable,  Next: div,  Prev: difftime,  Up: Alphabetical List
  1233. `disable'
  1234. =========
  1235. Syntax
  1236. ------
  1237.      #include <dos.h>
  1238.      
  1239.      void disable(void);
  1240. Description
  1241. -----------
  1242. This function disables interrupts.
  1243. *Note enable::
  1244. Return Value
  1245. ------------
  1246. None.
  1247. Example
  1248. -------
  1249.      disable();
  1250.      ...
  1251.      enable();
  1252. File: libcref,  Node: div,  Next: _doprnt,  Prev: disable,  Up: Alphabetical List
  1253. `div'
  1254. =====
  1255. Syntax
  1256. ------
  1257.      #include <stdlib.h>
  1258.      
  1259.      div_t div(int numberator, int denomonator);
  1260. Description
  1261. -----------
  1262. Returns the quotient and remainder of the division NUMBERATOR divided
  1263. by DENOMONATOR.  The return type is as follows:
  1264.      typedef struct {
  1265.        int quot;
  1266.        int rem;
  1267.      } div_t;
  1268. Return Value
  1269. ------------
  1270. The results of the division are returned.
  1271. Example
  1272. -------
  1273.      div_t d = div(42, 3);
  1274.      printf("42 = %d x 3 + %d\n", d.quot, d.rem);
  1275. File: libcref,  Node: _doprnt,  Next: _doscan,  Prev: div,  Up: Alphabetical List
  1276. `_doprnt'
  1277. =========
  1278. Syntax
  1279. ------
  1280.      #include <stdio.h>
  1281.      
  1282.      int _doprnt(const char *format, void *params, FILE *file);
  1283. Description
  1284. -----------
  1285. This is an internal function that is used by all the `printf' style
  1286. functions, which simply pass their format, arguments, and stream to this
  1287. function.
  1288. *Note printf:: for a discussion of the allowed formats and arguments.
  1289. Return Value
  1290. ------------
  1291. The number of characters generated is returned.
  1292. Example
  1293. -------
  1294.      int args[] = { 1, 2, 3, 66 };
  1295.      _doprnt("%d %d %d %c\n", args, stdout);
  1296. File: libcref,  Node: _doscan,  Next: _doscan_low,  Prev: _doprnt,  Up: Alphabetical List
  1297. `_doscan'
  1298. =========
  1299. Syntax
  1300. ------
  1301.      #include <stdio.h>
  1302.      
  1303.      int _doscan(FILE *file, const char *format, void **ptrs_to_args);
  1304. Description
  1305. -----------
  1306. This is an internal function that is used by all the `scanf' style
  1307. functions, which simply pass their format, arguments, and stream to this
  1308. function.
  1309. *Note scanf:: for a discussion of the allowed formats and arguments.
  1310. Return Value
  1311. ------------
  1312. The number of characters successfully scanned is returned, or -1 on
  1313. error.
  1314. Example
  1315. -------
  1316.      int x, y;
  1317.      int *args[2];
  1318.      args[0] = &x;
  1319.      args[1] = &y;
  1320.      _doscan(stdin, "%d %d", args);
  1321. File: libcref,  Node: _doscan_low,  Next: dosmemget,  Prev: _doscan,  Up: Alphabetical List
  1322. `_doscan_low'
  1323. =============
  1324. Description
  1325. -----------
  1326. This is an internal function used by _doscan.
  1327. File: libcref,  Node: dosmemget,  Next: dosmemput,  Prev: _doscan_low,  Up: Alphabetical List
  1328. `dosmemget'
  1329. ===========
  1330. Syntax
  1331. ------
  1332.      #include <go32.h>
  1333.      
  1334.      void dosmemget(int offset, int length, void *buffer);
  1335. Description
  1336. -----------
  1337. This function transfers data from MS-DOS's conventional memory space to
  1338. the program's virtual address space.  The OFFSET is a physical address,
  1339. which can be computed from a real-mode segment/offset pair as follows:
  1340.      offset = segment * 16 + offset;
  1341. The LENGTH is the number of bytes to transfer, and BUFFER is a pointer
  1342. to somewhere in your virtual address space (such as memory obtained
  1343. from `malloc') where the data will go.
  1344. Return Value
  1345. ------------
  1346. None.
  1347. Example
  1348. -------
  1349.      unsigned short shift_state;
  1350.      dosmemget(0x417, 2, &shift_state);
  1351.      if (shift_state & 0x0004)
  1352.        /* Ctrl key pressed */;
  1353. File: libcref,  Node: dosmemput,  Next: dup,  Prev: dosmemget,  Up: Alphabetical List
  1354. `dosmemput'
  1355. ===========
  1356. Syntax
  1357. ------
  1358.      #include <go32.h>
  1359.      
  1360.      void dosmemput(const void *buffer, int length, int offset);
  1361. Description
  1362. -----------
  1363. This function transfers data from the program's virtual address space to
  1364. MS-DOS's conventional memory space.  The OFFSET is a physical address,
  1365. which can be computed from a real-mode segment/offset pair as follows:
  1366.      offset = segment * 16 + offset;
  1367. The LENGTH is the number of bytes to transfer, and BUFFER is a pointer
  1368. to somewhere in your virtual address space (such as memory obtained
  1369. from `malloc') where the data will come from.
  1370. Return Value
  1371. ------------
  1372. None.
  1373. Example
  1374. -------
  1375.      unsigned short save_screen[25][80];
  1376.      dosmemput(save_screen, 0xb8000, 80*2*25);
  1377. File: libcref,  Node: dup,  Next: dup2,  Prev: dosmemput,  Up: Alphabetical List
  1378. `dup'
  1379. =====
  1380. Syntax
  1381. ------
  1382.      #include <osfcn.h>
  1383.      
  1384.      int dup(int old_handle);
  1385. Description
  1386. -----------
  1387. This function duplicates the given file handle.  Both handles refer to
  1388. the same file and file pointer.
  1389. Return Value
  1390. ------------
  1391. The new file handle, or -1 if error.
  1392. Example
  1393. -------
  1394.      do_file(dup(fileno(stdin)));
  1395. File: libcref,  Node: dup2,  Next: enable,  Prev: dup,  Up: Alphabetical List
  1396. `dup2'
  1397. ======
  1398. Syntax
  1399. ------
  1400.      #include <osfcn.h>
  1401.      
  1402.      int dup2(int existing_handle, int new_handle);
  1403. Description
  1404. -----------
  1405. This call causes NEW_HANDLE to refer to the same file and file pointer
  1406. as EXISTING_HANDLE.  If NEW_HANDLE is an open file, it is closed.
  1407. Return Value
  1408. ------------
  1409. The new handle, or -1 on error.
  1410. Example
  1411. -------
  1412.      /* copy new file to stdin stream */
  1413.      close(0);
  1414.      dup2(new_stdin, 0);
  1415.      close(new_stdin);
  1416. File: libcref,  Node: enable,  Next: endgrent,  Prev: dup2,  Up: Alphabetical List
  1417. `enable'
  1418. ========
  1419. Syntax
  1420. ------
  1421.      #include <dos.h>
  1422.      
  1423.      void enable(void);
  1424. Description
  1425. -----------
  1426. This function enables interrupts.
  1427. *Note disable::
  1428. Return Value
  1429. ------------
  1430. None.
  1431. Example
  1432. -------
  1433.      disable();
  1434.      ...
  1435.      enable();
  1436. File: libcref,  Node: endgrent,  Next: endmntent,  Prev: enable,  Up: Alphabetical List
  1437. `endgrent'
  1438. ==========
  1439. Syntax
  1440. ------
  1441.      #include <grp.h>
  1442.      
  1443.      void endgrent(void);
  1444. Description
  1445. -----------
  1446. This function should be called after all calls to getgrent, getgrgid, or
  1447. getgrnam.
  1448. Return Value
  1449. ------------
  1450. None.
  1451. Example
  1452. -------
  1453. *Note getgrent::
  1454. File: libcref,  Node: endmntent,  Next: endpwent,  Prev: endgrent,  Up: Alphabetical List
  1455. `endmntent'
  1456. ===========
  1457. Syntax
  1458. ------
  1459.      #include <mntent.h>
  1460.      
  1461.      int endmntent(FILE *filep);
  1462. Description
  1463. -----------
  1464. This function should be called after the last call to getmntent (*Note
  1465. getmntent::).
  1466. Return Value
  1467. ------------
  1468. This function always returns one.
  1469. File: libcref,  Node: endpwent,  Next: errno,  Prev: endmntent,  Up: Alphabetical List
  1470. `endpwent'
  1471. ==========
  1472. Syntax
  1473. ------
  1474.      #include <pwd.h>
  1475.      
  1476.      void endpwent(void);
  1477. Description
  1478. -----------
  1479. This function should be called after the last call to getpwent (*Note
  1480. getpwent::).
  1481. Return Value
  1482. ------------
  1483. None.
  1484. File: libcref,  Node: errno,  Next: exec*,  Prev: endpwent,  Up: Alphabetical List
  1485. `errno'
  1486. =======
  1487. Syntax
  1488. ------
  1489.      #include <errno.h>
  1490.      
  1491.      extern int errno;
  1492. Description
  1493. -----------
  1494. This variable is used to hold the value of the error of the last
  1495. function call.  For details about the various error types, please refer
  1496. to the file `include/errno.h'.
  1497. *Note perror::
  1498. File: libcref,  Node: exec*,  Next: _exit,  Prev: errno,  Up: Alphabetical List
  1499. `exec*'
  1500. =======
  1501. Syntax
  1502. ------
  1503.      #include <process.h>
  1504.      
  1505.      int execl(const char *path, const char *argv0, ...);
  1506.      int execle(const char *path, const char *argv0, ... /*, const char **envp */);
  1507.      int execlp(const char *path, const char *argv0, ...);
  1508.      int execlpe(const char *path, const char *argv0, ... /*, const char **envp */);
  1509.      
  1510.      int execv(const char *path, const char **argv);
  1511.      int execve(const char *path, const char **argv, const char **envp);
  1512.      int execvp(const char *path, const char **argv);
  1513.      int execvpe(const char *path, const char **argv, const char **envp);
  1514. Description
  1515. -----------
  1516. These functions operate by calling `spawn*' with a type of `P_OVERLAY'.
  1517. Refer to *Note spawn*:: for a full description.
  1518. Return Value
  1519. ------------
  1520. If successful, these functions do not return.  If there is an error,
  1521. these functions return -1 and set `errno' to indicate the error.
  1522. Example
  1523. -------
  1524.      execlp("gcc", "gcc", "-v", "hello.c", 0);
  1525. File: libcref,  Node: _exit,  Next: exit,  Prev: exec*,  Up: Alphabetical List
  1526. `_exit'
  1527. =======
  1528. Syntax
  1529. ------
  1530.      #include <stdlib.h>
  1531.      
  1532.      void volatile _exit(int exit_code);
  1533. Description
  1534. -----------
  1535. This function exits the application immediately, without performing any
  1536. `atexit' or `on_exit' requests or closing any files.  The program will
  1537. return EXIT_CODE to the calling process as the exit code.
  1538. Return Value
  1539. ------------
  1540. This function does not return.
  1541. File: libcref,  Node: exit,  Next: _f_morefiles,  Prev: _exit,  Up: Alphabetical List
  1542. `exit'
  1543. ======
  1544. Syntax
  1545. ------
  1546.      #include <stdlib.h>
  1547.      
  1548.      void volatile exit(int exit_code);
  1549. Description
  1550. -----------
  1551. This function exits the program, returning EXIT_CODE to the calling
  1552. process.  Before exiting, all open files are closed and all `atexit'
  1553. and `on_exit' requests are processed.
  1554. Return Value
  1555. ------------
  1556. This function does not return.
  1557. Example
  1558. -------
  1559.      if (argc < 4)
  1560.      {
  1561.        print_usage();
  1562.        exit(1);
  1563.      }
  1564. File: libcref,  Node: _f_morefiles,  Next: fchmod,  Prev: exit,  Up: Alphabetical List
  1565. `_f_morefiles'
  1566. ==============
  1567. Description
  1568. -----------
  1569. This is an internal function used by `fopen'. *Note fopen::
  1570. File: libcref,  Node: fchmod,  Next: fclose,  Prev: _f_morefiles,  Up: Alphabetical List
  1571. `fchmod'
  1572. ========
  1573. Syntax
  1574. ------
  1575.      #include <unistd.h>
  1576.      
  1577.      int fchmod(int file, int mode);
  1578. Description
  1579. -----------
  1580. This function is not implemented under MS-DOS.  If you call it, it will
  1581. only write a warning to stderr.
  1582. File: libcref,  Node: fclose,  Next: fdopen,  Prev: fchmod,  Up: Alphabetical List
  1583. `fclose'
  1584. ========
  1585. Syntax
  1586. ------
  1587.      #include <stdio.h>
  1588.      
  1589.      int fclose(FILE *file);
  1590. Description
  1591. -----------
  1592. This function closes the given FILE.
  1593. Return Value
  1594. ------------
  1595. Zero on success, else `EOF'.
  1596. Example
  1597. -------
  1598.      FILE *f = fopen("data", "r");
  1599.      fprintf(f, "Hello\n");
  1600.      fclose(f);
  1601. File: libcref,  Node: fdopen,  Next: feof,  Prev: fclose,  Up: Alphabetical List
  1602. `fdopen'
  1603. ========
  1604. Syntax
  1605. ------
  1606.      #include <stdio.h>
  1607.      
  1608.      FILE *fdopen(int fd, const char *mode);
  1609. Description
  1610. -----------
  1611. This function opens a stream-type file that uses the given FD file,
  1612. which must already be open.  The file is opened with the modes
  1613. specified by MODE, which is the same as for `fopen'.  *Note fopen::
  1614. Return Value
  1615. ------------
  1616. The newly created `FILE *', or `NULL' on error.
  1617. Example
  1618. -------
  1619.      FILE *stdprn = fdopen(4, "w");
  1620. File: libcref,  Node: feof,  Next: ferror,  Prev: fdopen,  Up: Alphabetical List
  1621. `feof'
  1622. ======
  1623. Syntax
  1624. ------
  1625.      #include <stdio.h>
  1626.      
  1627.      int feof(FILE *file);
  1628. Description
  1629. -----------
  1630. This function (actually a macro) can be used to indicate if the given
  1631. FILE is at the end-of-file or not.
  1632. Return Value
  1633. ------------
  1634. Nonzero at end-of-file, zero otherwise.
  1635. Example
  1636. -------
  1637.      while (!feof(stdin))
  1638.        gets(line);
  1639. File: libcref,  Node: ferror,  Next: fflush,  Prev: feof,  Up: Alphabetical List
  1640. `ferror'
  1641. ========
  1642. Syntax
  1643. ------
  1644.      #include <stdio.h>
  1645.      
  1646.      int ferror(FILE *file);
  1647. Description
  1648. -----------
  1649. This function (actually a macro) can be used to indicate if the given
  1650. FILE has encountered an error or not.  *Note clearerr::
  1651. Return Value
  1652. ------------
  1653. Nonzero for an error, zero otherwize.
  1654. Example
  1655. -------
  1656.      if (ferror(stdin))
  1657.        exit(1);
  1658. File: libcref,  Node: fflush,  Next: ffs,  Prev: ferror,  Up: Alphabetical List
  1659. `fflush'
  1660. ========
  1661. Syntax
  1662. ------
  1663.      #include <stdio.h>
  1664.      
  1665.      int fflush(FILE *file);
  1666. Description
  1667. -----------
  1668. This function causes any unwritten buffered data to be written out to
  1669. the given FILE.  This is useful in cases where the output is line
  1670. buffered and you want to write a partial line.
  1671. Return Value
  1672. ------------
  1673. Zero on success, -1 on error.
  1674. Example
  1675. -------
  1676.      printf("Enter value : ");
  1677.      fflush(stdout);
  1678.      scanf(result);
  1679. File: libcref,  Node: ffs,  Next: fgetc,  Prev: fflush,  Up: Alphabetical List
  1680. `ffs'
  1681. =====
  1682. Syntax
  1683. ------
  1684.      #include <string.h>
  1685.      int ffs(int mask);
  1686. Description
  1687. -----------
  1688. This function returns the position of the least significant bit set in
  1689. MASK.  For example:
  1690.      ffs(0x00000000) == 0
  1691.      ffs(0x00000001) == 1
  1692.      ffs(0x00000002) == 2
  1693.      ffs(0x00000004) == 3
  1694.      ffs(0x00010000) == 17
  1695.      ffs(0x00010010) == 5
  1696. Return Value
  1697. ------------
  1698. The position of the bit, or zero if none are set.
  1699. File: libcref,  Node: fgetc,  Next: fgetgrent,  Prev: ffs,  Up: Alphabetical List
  1700. `fgetc'
  1701. =======
  1702. Syntax
  1703. ------
  1704.      #include <stdio.h>
  1705.      
  1706.      int fgetc(FILE *file);
  1707. Description
  1708. -----------
  1709. Returns the next character in the given FILE as an unsigned char.
  1710. Return Value
  1711. ------------
  1712. The given char (value 0..255) or `EOF' at end-of-file.
  1713. Example
  1714. -------
  1715.      int c;
  1716.      while((c=fgetc(stdin)) != EOF)
  1717.        fputc(c, stdout);
  1718. File: libcref,  Node: fgetgrent,  Next: fgetpos,  Prev: fgetc,  Up: Alphabetical List
  1719. `fgetgrent'
  1720. ===========
  1721. Syntax
  1722. ------
  1723.      #include <grp.h>
  1724.      
  1725.      struct group *fgetgrent(FILE *file);
  1726. Description
  1727. -----------
  1728. This function, in MS-DOS, is exactly the same as getgrent (*Note
  1729. getgrent::).
  1730. File: libcref,  Node: fgetpos,  Next: fgetpwent,  Prev: fgetgrent,  Up: Alphabetical List
  1731. `fgetpos'
  1732. =========
  1733. Syntax
  1734. ------
  1735.      #include <stdio.h>
  1736.      
  1737.      int fgetpos(FILE *file, fpos_t *offset);
  1738. Description
  1739. -----------
  1740. This function records the current file pointer for FILE, for later use
  1741. by `fsetpos'.
  1742. *Note fsetpos::.
  1743. *Note ftell::.
  1744. Return Value
  1745. ------------
  1746. Zero if successful, nonzero if not.
  1747. File: libcref,  Node: fgetpwent,  Next: fgets,  Prev: fgetpos,  Up: Alphabetical List
  1748. `fgetpwent'
  1749. ===========
  1750. Syntax
  1751. ------
  1752.      #include <pwd.h>
  1753.      
  1754.      struct passwd *fgetpwent(FILE *file);
  1755. Description
  1756. -----------
  1757. This function, in MS-DOS, is exactly like `getpwent' (*Note getpwent::).
  1758. File: libcref,  Node: fgets,  Next: _filbuf,  Prev: fgetpwent,  Up: Alphabetical List
  1759. `fgets'
  1760. =======
  1761. Syntax
  1762. ------
  1763.      #include <stdio.h>
  1764.      
  1765.      char *fgets(char *buffer, int maxlength, FILE *file);
  1766. Description
  1767. -----------
  1768. This function reads as much of a line from a file as possible, stopping
  1769. when the buffer is full (MAXLENGTH-1 characters), an end-of-line is
  1770. detected, or `EOF' or an error is detected.  It then stores a `NULL' to
  1771. terminate the string.
  1772. Return Value
  1773. ------------
  1774. The address of the buffer is returned on success, if `EOF' is
  1775. encountered before any characters are stored, or if an error is
  1776. detected, `NULL' is returned instead.
  1777. Example
  1778. -------
  1779.      char buf[100];
  1780.      while (fgets(buf, 100, stdin))
  1781.        fputs(buf, stdout);
  1782. File: libcref,  Node: _filbuf,  Next: fileno,  Prev: fgets,  Up: Alphabetical List
  1783. `_filbuf'
  1784. =========
  1785. Description
  1786. -----------
  1787. This is an internal function used to implement stream buffering.
  1788. File: libcref,  Node: fileno,  Next: _findenv,  Prev: _filbuf,  Up: Alphabetical List
  1789. `fileno'
  1790. ========
  1791. Syntax
  1792. ------
  1793.      #include <stdio.h>
  1794.      
  1795.      int fileno(FILE *file);
  1796. Description
  1797. -----------
  1798. This function returns the raw file descriptor number that FILE uses for
  1799. Return Value
  1800. ------------
  1801. The file descriptor number.
  1802. File: libcref,  Node: _findenv,  Next: findfirst,  Prev: fileno,  Up: Alphabetical List
  1803. `_findenv'
  1804. ==========
  1805. Description
  1806. -----------
  1807. This is an internal function used by `getenv' and `setenv'.  *Note
  1808. getenv:: *Note setenv::
  1809. File: libcref,  Node: findfirst,  Next: _findiop,  Prev: _findenv,  Up: Alphabetical List
  1810. `findfirst'
  1811. ===========
  1812. Syntax
  1813. ------
  1814.      #include <dir.h>
  1815.      
  1816.      int findfirst(const char *pathname, struct ffblk *ffblk, int attrib);
  1817. Description
  1818. -----------
  1819. This function and the related `findnext' are used to scan directories
  1820. for the list of files therein.  The PATHNAME is a wildcard that
  1821. specifies the directory and files to search for (such as `subdir/*.c'),
  1822. FFBLK is a structure to hold the results and state of the search, and
  1823. ATTRIB is a combination of the following:
  1824. `FA_RDONLY'
  1825.      Include read-only files in the search
  1826. `FA_HIDDEN'
  1827.      Include hidden files in the search
  1828. `FA_SYSTEM'
  1829.      Include system files in the search
  1830. `FA_LABEL'
  1831.      Include the volume label in the search
  1832. `FA_DIREC'
  1833.      Include subdirectories in the search
  1834. `FA_ARCH'
  1835.      Include modified files in the search
  1836. Any file that doesn't have any flag bits that aren't specified is
  1837. selected for the search.  Thus, if you specified `FA_DIREC' and
  1838. `FA_LABEL', you would get all subdirectories, the volume label, and any
  1839. file that is neither read-only or modified.
  1840. The results of the search are stored in FFBLK:
  1841.      struct ffblk {
  1842.        char ff_reserved[21];  /* used to hold the state of the search */
  1843.        char ff_attrib;        /* actual attributes of the file found */
  1844.        short ff_ftime;        /* hours:5, minutes:6, (seconds/2):5 */
  1845.        short ff_fdate;        /* (year-1980):7, month:4, day:5 */
  1846.        short ff_filler;       /* gcc aligns "long" different than DOS */
  1847.        long ff_fsize;         /* size of file */
  1848.        char ff_name[16];      /* name of file as ASCIIZ string */
  1849.      }
  1850. Return Value
  1851. ------------
  1852. Zero if a match is found, nonzero if none found.
  1853. Example
  1854. -------
  1855.      struct ffblk f;
  1856.      int done = findfirst("*.exe", &f, FA_ARCH|FA_RDONLY);
  1857.      while (!done)
  1858.      {
  1859.        printf("%10u %2d:%02d:%02d %2d/%02d/%4d %s\n",
  1860.          f.ff_fsize,
  1861.          (f.ff_ftime >> 11) & 0x1f,
  1862.          (f.ff_ftime >>  5) & 0x3f,
  1863.          (f.ff_ftime & 0x1f) * 2,
  1864.          (f.ff_fdate >>  5) & 0x0f,
  1865.          (f.ff_fdate & 0x1f),
  1866.          ((f.ff_fdate >> 9) & 0x7f) + 1980,
  1867.          f.ff_name);
  1868.        done = findnext(&f);
  1869.      }
  1870. File: libcref,  Node: _findiop,  Next: findnext,  Prev: findfirst,  Up: Alphabetical List
  1871. `_findiop'
  1872. ==========
  1873. Description
  1874. -----------
  1875. This is an internal function used by `fopen'. *Note fopen::
  1876. File: libcref,  Node: findnext,  Next: _fixpath,  Prev: _findiop,  Up: Alphabetical List
  1877. `findnext'
  1878. ==========
  1879. Syntax
  1880. ------
  1881.      #include <dir.h>
  1882.      
  1883.      int findnext(struct ffblk *ffblk);
  1884. Description
  1885. -----------
  1886. This finds the next file in the search started by `findfirst'. *Note
  1887. findfirst::
  1888. Return Value
  1889. ------------
  1890. Zero if there was a match, else nonzero.
  1891. File: libcref,  Node: _fixpath,  Next: _flsbuf,  Prev: findnext,  Up: Alphabetical List
  1892. `_fixpath'
  1893. ==========
  1894. Syntax
  1895. ------
  1896.      void _fixpath(const char *in_path, char *out_path);
  1897. Description
  1898. -----------
  1899. This function canonacalizes the input path IN_PATH and stores the
  1900. result in the buffer pointed to by OUT_PATH.
  1901. The path is fixed by removing consecutive and trailing slashes, making
  1902. the path absolute if it's relative, removing "." components, collapsing
  1903. ".." components, adding a drive specifier if needed, and converting all
  1904. slashes to '/'.
  1905. Return Value
  1906. ------------
  1907. None.
  1908. Example
  1909. -------
  1910.      char oldpath[100], newpath[100];
  1911.      scanf(oldpath);
  1912.      _fixpath(oldpath, newpath);
  1913.      printf("that really is %s\n", newpath);
  1914. File: libcref,  Node: _flsbuf,  Next: _fmode,  Prev: _fixpath,  Up: Alphabetical List
  1915. `_flsbuf'
  1916. =========
  1917. Description
  1918. -----------
  1919. This is an internal function used to implement stream buffering.
  1920. File: libcref,  Node: _fmode,  Next: fnmatch,  Prev: _flsbuf,  Up: Alphabetical List
  1921. `_fmode'
  1922. ========
  1923. Syntax
  1924. ------
  1925.      #include <fcntl.h>
  1926.      
  1927.      extern int _fmode;
  1928. Description
  1929. -----------
  1930. This variable may be set to `O_TEXT' or `O_BINARY' to specify the mode
  1931. that newly opened files should be opened in if the open call did not
  1932. specify.  *Note open:: *Note fopen::
  1933. The default value is `O_TEXT'.
  1934. Example
  1935. -------
  1936.      _fmode = O_BINARY;
  1937. File: libcref,  Node: fnmatch,  Next: fnmerge,  Prev: _fmode,  Up: Alphabetical List
  1938. `fnmatch'
  1939. =========
  1940. Syntax
  1941. ------
  1942.      #include <unistd.h>
  1943.      
  1944.      int fnmatch(const char *pattern, const char *string, int flags);
  1945. Description
  1946. -----------
  1947. This function indicates if STRING matches the PATTERN.  The pattern may
  1948. include the following special characters:
  1949.      Matches zero of more characters.
  1950.      Matches exactly one character
  1951. `[...]'
  1952.      Matches one character if it's in a range of characters.  If the
  1953.      first character is `!', matches if the character is not in the
  1954.      range.  Between the brackets, the range is specified by listing
  1955.      the characters that are in the range, or two characters separated
  1956.      by `-' to indicate all characters in that range.  For example,
  1957.      `[a-d]' matches `a', `b', `c', or `d'.
  1958.      Causes the next character to not be treated as a wildcard.  For
  1959.      example, `\*' matches an asterisk.  This is only available if FLAGS
  1960.      includes `FNM_QUOTE'.
  1961. The value of FLAGS is a combination of zero of more of the following:
  1962. `FNM_PATHNAME'
  1963.      This means that the string should be treated as a pathname, in
  1964.      that the slash character `/' never matches any of the wildcards.
  1965. `FNM_QUOTE'
  1966.      This means that the backslash `\\' may be used for quoting special
  1967.      characters in the pattern.
  1968. Return Value
  1969. ------------
  1970. Zero if the string does not match, nonzero if it does.
  1971. Example
  1972. -------
  1973.      if (fnmatch("*.[ch]", filename, FNM_PATH|FNM_QUOTE))
  1974.        do_source_file(filename);
  1975. File: libcref,  Node: fnmerge,  Next: fnsplit,  Prev: fnmatch,  Up: Alphabetical List
  1976. `fnmerge'
  1977. =========
  1978. Syntax
  1979. ------
  1980.      #include <dir.h>
  1981.      
  1982.      void fnmerge (char *path, const char *drive, const char *dir,
  1983.              const char *name, const char *ext);
  1984. Description
  1985. -----------
  1986. This function constructs a file PATH from its components.
  1987. *Note fnsplit::
  1988. Return Value
  1989. ------------
  1990. None.
  1991. Example
  1992. -------
  1993.      char buf[MAXPATH];
  1994.      fnmerge(buf, "d:", "/foo/", "data", ".txt");
  1995. File: libcref,  Node: fnsplit,  Next: fopen,  Prev: fnmerge,  Up: Alphabetical List
  1996. `fnsplit'
  1997. =========
  1998. Syntax
  1999. ------
  2000.      #include <dir.h>
  2001.      
  2002.      int fnsplit (const char *path, char *drive, char *dir,
  2003.              char *name, char *ext);
  2004. Description
  2005. -----------
  2006. This function decomposes a PATH into its components.
  2007. *Note fnmerge::
  2008. Return Value
  2009. ------------
  2010. A flag that indicates which components were found:
  2011. `DRIVE'
  2012.      The drive letter was found.
  2013. `DIRECTORY'
  2014.      A directory or subdirectories was found.
  2015. `FILENAME'
  2016.      A filename was found.
  2017. `EXTENSION'
  2018.      An extension was found.
  2019. `WILDCARDS'
  2020.      The path included `*' or `?'.
  2021. Example
  2022. -------
  2023.      char d[MAXDRIVE], p[MAXDIR], f[MAXFILE], e[MAXEXT];
  2024.      int which = fnsplit("d:/djgpp/bin/gcc.exe", d, p, f, e);
  2025.      d = "d:"
  2026.      p = "/djgpp/bin/"
  2027.      f = "gcc"
  2028.      e = ".exe"
  2029. File: libcref,  Node: fopen,  Next: fork,  Prev: fnsplit,  Up: Alphabetical List
  2030. `fopen'
  2031. =======
  2032. Syntax
  2033. ------
  2034.      #include <stdio.h>
  2035.      FILE *fopen(const char *filename, const char *mode);
  2036. Description
  2037. -----------
  2038. This function opens a stream corresponding to the named FILENAME with
  2039. the given MODE.  The mode can be one of the following:
  2040.      Open an existing file for reading.
  2041.      Create a new file (or truncate an existing file) and open it for
  2042.      writing.
  2043.      Open an existing file (or create a new one) for writing.  The file
  2044.      pointer is positioned to the end of the file before every write.
  2045. Followed by any of these characters:
  2046.      Force the file to be open in binary mode instead of the default
  2047.      mode.
  2048.      Force the file to be open in text mode instead of the default mode.
  2049.      Open the file as with `O_RDWR' so that both reads and writes can
  2050.      be done to the same file.
  2051. If the file is open for both reading and writing, you must call
  2052. `fflush', `fseek', or `rewind' before switching from read to write or
  2053. from write to read.
  2054. The open file is set to line buffered if the underlying object is a
  2055. device (stdin, stdout, etc), or is fully buffered if the underlying
  2056. object is a disk file (data.c, etc).
  2057. If `b' or `t' is not specified in MODE, the file type is chosen by the
  2058. value of `fmode' (*Note _fmode::).
  2059. Return Value
  2060. ------------
  2061. A pointer to the `FILE' object, or `NULL' if there was an error.
  2062. Example
  2063. -------
  2064.      FILE *f = fopen("foo", "rb+"); /* open existing file for read/write, binary mode */
  2065. File: libcref,  Node: fork,  Next: fpathconf,  Prev: fopen,  Up: Alphabetical List
  2066. `fork'
  2067. ======
  2068. Description
  2069. -----------
  2070. This function always returns -1, as MS-DOS does not support multiple
  2071. processes.  It exists only to assist in porting Unix programs.
  2072. File: libcref,  Node: fpathconf,  Next: fprintf,  Prev: fork,  Up: Alphabetical List
  2073. `fpathconf'
  2074. ===========
  2075. Syntax
  2076. ------
  2077.      #include <unistd.h>
  2078.      
  2079.      long fpathconf(int fd, int name);
  2080. Description
  2081. -----------
  2082. Returns configuration information on the filesystem that the open file
  2083. resides on.  *Note pathconf::
  2084. Return Value
  2085. ------------
  2086. The configuration value.
  2087. File: libcref,  Node: fprintf,  Next: fpurge,  Prev: fpathconf,  Up: Alphabetical List
  2088. `fprintf'
  2089. =========
  2090. Syntax
  2091. ------
  2092.      #include <stdio.h>
  2093.      
  2094.      int fprintf(FILE *file, const char *format, ...);
  2095. Description
  2096. -----------
  2097. Prints formatted output to the named file.  *Note printf::
  2098. Return Value
  2099. ------------
  2100. The number of characters written.
  2101. File: libcref,  Node: fpurge,  Next: fputc,  Prev: fprintf,  Up: Alphabetical List
  2102. `fpurge'
  2103. ========
  2104. Syntax
  2105. ------
  2106.      #include <stdio.h>
  2107.      
  2108.      int fpurge(FILE *file);
  2109. Description
  2110. -----------
  2111. This function purges the buffer for FILE without writing it to disk.
  2112. Return Value
  2113. ------------
  2114. Zero on success, -1 on failure.
  2115. File: libcref,  Node: fputc,  Next: fputs,  Prev: fpurge,  Up: Alphabetical List
  2116. `fputc'
  2117. =======
  2118. Syntax
  2119. ------
  2120.      #include <stdio.h>
  2121.      
  2122.      int fputc(int character, FILE *file);
  2123. Description
  2124. -----------
  2125. This function writes the given CHARACTER to the given `file'.
  2126. Return Value
  2127. ------------
  2128. The given character [0..255] or `EOF'.
  2129. Example
  2130. -------
  2131.      fputc('\n', stdout);
  2132. File: libcref,  Node: fputs,  Next: fread,  Prev: fputc,  Up: Alphabetical List
  2133. `fputs'
  2134. =======
  2135. Syntax
  2136. ------
  2137.      #include <stdio.h>
  2138.      
  2139.      int fputs(const char *string, FILE *file);
  2140. Description
  2141. -----------
  2142. This function all the characters of STRING (except the trailing `NULL')
  2143. to the given FILE.
  2144. Return Value
  2145. ------------
  2146. A nonnegative number on success, `EOF' on error.
  2147. Example
  2148. -------
  2149.      fputs("Hello\n", stdout);
  2150. File: libcref,  Node: fread,  Next: free,  Prev: fputs,  Up: Alphabetical List
  2151. `fread'
  2152. =======
  2153. Syntax
  2154. ------
  2155.      #include <stdio.h>
  2156.      
  2157.      size_t fread(void *buffer, size_t size, size_t number, FILE *file);
  2158. Description
  2159. -----------
  2160. This function reads SIZE*NUMBER characters from FILE to BUFFER.
  2161. Return Value
  2162. ------------
  2163. The number of items of size SIZE read, or -1 on error.
  2164. Example
  2165. -------
  2166.      int foo[10];
  2167.      fread(foo, sizeof(int), 10, stdin);
  2168. File: libcref,  Node: free,  Next: freopen,  Prev: fread,  Up: Alphabetical List
  2169. `free'
  2170. ======
  2171. Syntax
  2172. ------
  2173.      #include <stdio.h>
  2174.      
  2175.      void free(void *ptr);
  2176. Description
  2177. -----------
  2178. Returns the allocated memory to the heap (*Note malloc::).  If the PTR
  2179. is `NULL', it does nothing.
  2180. Return Value
  2181. ------------
  2182. None.
  2183. Example
  2184. -------
  2185.      char *q = (char *)malloc(20);
  2186.      free(q);
  2187. File: libcref,  Node: freopen,  Next: fscanf,  Prev: free,  Up: Alphabetical List
  2188. `freopen'
  2189. =========
  2190. Syntax
  2191. ------
  2192.      #include <stdio.h>
  2193.      
  2194.      FILE *freopen(const char *filename, const char *mode, FILE *file);
  2195. Description
  2196. -----------
  2197. This function closes FILE if it was open, then opens a new file like
  2198. `fopen(filename, mode)' but it reuses FILE.
  2199. This is useful to, for example, associate `stdout' with a new file.
  2200. Return Value
  2201. ------------
  2202. The new file, or `NULL' on error.
  2203. Example
  2204. -------
  2205.      freopen("/tmp/stdout.dat", "wb", stdout);
  2206. File: libcref,  Node: fscanf,  Next: fseek,  Prev: freopen,  Up: Alphabetical List
  2207. `fscanf'
  2208. ========
  2209. Syntax
  2210. ------
  2211.      #include <stdio.h>
  2212.      
  2213.      int fscanf(FILE *file, const char *format, ...);
  2214. Description
  2215. -----------
  2216. This function scans formatted text from FILE and stores it in the
  2217. variables pointed to by the arguments.  *Note scanf::
  2218. Return Value
  2219. ------------
  2220. The number of items successfully scanned.
  2221. File: libcref,  Node: fseek,  Next: fsetpos,  Prev: fscanf,  Up: Alphabetical List
  2222. `fseek'
  2223. =======
  2224. Syntax
  2225. ------
  2226.      #include <stdio.h>
  2227.      
  2228.      int fseek(FILE *file, long offset, int mode);
  2229. Description
  2230. -----------
  2231. This function moves the file pointer for FILE according to MODE:
  2232. `SEEK_SET'
  2233.      The file pointer is moved to the offset specified.
  2234. `SEEK_CUR'
  2235.      The file pointer is moved relative to its current position.
  2236. `SEEK_END'
  2237.      The file pointer is moved to a position OFFSET bytes from the end
  2238.      of the file.  The offset is usually nonpositive in this case.
  2239. *Warning!* The ANSI standard only allows values of zero for OFFSET when
  2240. WHENCE is not `SEEK_SET' and the file has been opened as a text file.
  2241. Although this restriction is not enforced, beware that there is not a
  2242. one-to-one correspondence between file characters and text characters
  2243. under MS-DOS, so some `fseek' operations may not do exactly what you
  2244. expect.
  2245. Return Value
  2246. ------------
  2247. Zero if successful, nonzero if not.
  2248. Example
  2249. -------
  2250.      fseek(stdin, 12, SEEK_CUR); /* skip 12 bytes */
  2251. File: libcref,  Node: fsetpos,  Next: fstat,  Prev: fseek,  Up: Alphabetical List
  2252. `fsetpos'
  2253. =========
  2254. Syntax
  2255. ------
  2256.      #include <stdio.h>
  2257.      
  2258.      int fsetpos(FILE *file, const fpos_t *offset);
  2259. Description
  2260. -----------
  2261. This function moves the file pointer for FILE to position OFFSET, as
  2262. recorded by `fgetpos'.
  2263. *Note fgetpos::.
  2264. *Note fseek::.
  2265. Return Value
  2266. ------------
  2267. Zero if successful, nonzero if not.
  2268. File: libcref,  Node: fstat,  Next: fsync,  Prev: fsetpos,  Up: Alphabetical List
  2269. `fstat'
  2270. =======
  2271. Syntax
  2272. ------
  2273.      #include <sys/stat.h>
  2274.      
  2275.      int fstat(int file, struct stat *sbuf);
  2276. Description
  2277. -----------
  2278. This function obtains the status of the open file FILE and stores it in
  2279. SBUF.  *Note stat::
  2280. Return Value
  2281. ------------
  2282. Zero on success, nonzero on failure.
  2283. File: libcref,  Node: fsync,  Next: ftell,  Prev: fstat,  Up: Alphabetical List
  2284. `fsync'
  2285. =======
  2286. Syntax
  2287. ------
  2288.      #include <osfcn.h>
  2289.      
  2290.      int fsync(int file);
  2291. Description
  2292. -----------
  2293. Forces all information about the file to be synchronized with the disk
  2294. image.
  2295. Return Value
  2296. ------------
  2297. Zero on success, nonzero on failure.
  2298. Example
  2299. -------
  2300.      fsync(fileno(stdout));
  2301. File: libcref,  Node: ftell,  Next: ftime,  Prev: fsync,  Up: Alphabetical List
  2302. `ftell'
  2303. =======
  2304. Syntax
  2305. ------
  2306.      #include <stdio.h>
  2307.      
  2308.      long ftell(FILE *file);
  2309. Description
  2310. -----------
  2311. Returns the current file position for `file'.  This is suitable for a
  2312. future call to `fseek'.
  2313. Return Value
  2314. ------------
  2315. The file position, or -1 on error.
  2316. Example
  2317. -------
  2318.      long p = ftell(stdout);
  2319. File: libcref,  Node: ftime,  Next: ftruncate,  Prev: ftell,  Up: Alphabetical List
  2320. `ftime'
  2321. =======
  2322. Syntax
  2323. ------
  2324.      #include <sys/timeb.h>
  2325.      
  2326.      int ftime(struct timeb *buf);
  2327. Description
  2328. -----------
  2329. This function stores the current time in the structure BUF.  The format
  2330. of `struct timeb' is:
  2331.      struct timeb {
  2332.        time_t         time;     /* seconds since 00:00:00 GMT 1/1/1970 */
  2333.        unsigned short millitm;  /* milliseconds */
  2334.        short          timezone; /* difference between GMT and local, minutes */
  2335.        short          dstflag;  /* set if daylight savings time in affect */
  2336.      };
  2337. Return Value
  2338. ------------
  2339. Zero on success, nonzero on error.
  2340. Example
  2341. -------
  2342.      struct timeb t;
  2343.      ftime(&t);
  2344. File: libcref,  Node: ftruncate,  Next: _fwalk,  Prev: ftime,  Up: Alphabetical List
  2345. `ftruncate'
  2346. ===========
  2347. Syntax
  2348. ------
  2349.      #include <osfcn.h>
  2350.      
  2351.      int ftruncate(int file, unsigned long where);
  2352. Description
  2353. -----------
  2354. This function truncates FILE at WHERE length.  This only works if the
  2355. file is closed right after this call.
  2356. Return Value
  2357. ------------
  2358. Zero for success, nonzero for failure.
  2359. Example
  2360. -------
  2361.      int x = open("data", O_WRONLY);
  2362.      ftruncate(x, 1000);
  2363.      close(x);
  2364. File: libcref,  Node: _fwalk,  Next: fwrite,  Prev: ftruncate,  Up: Alphabetical List
  2365. `_fwalk'
  2366. ========
  2367. Syntax
  2368. ------
  2369.      void _fwalk(void (*function)(FILE *file));
  2370. Description
  2371. -----------
  2372. For each open file in the system, the given FUNCTION is called, passing
  2373. the file pointer as it's only argument
  2374. Return Value
  2375. ------------
  2376. None.
  2377. Example
  2378. -------
  2379.      void pfile(FILE *x)
  2380.      { printf("FILE at %x\n", x); }
  2381.      
  2382.      _fwalk(pfile);
  2383. File: libcref,  Node: fwrite,  Next: _get_default_drive,  Prev: _fwalk,  Up: Alphabetical List
  2384. `fwrite'
  2385. ========
  2386. Syntax
  2387. ------
  2388.      #include <stdio.h>
  2389.      
  2390.      size_t fwrite(void *buffer, size_t size, size_t number, FILE *file);
  2391. Description
  2392. -----------
  2393. This function writes SIZE*NUMBER characters from BUFFER to FILE.
  2394. Return Value
  2395. ------------
  2396. The number of items of size SIZE written, or -1 on error.
  2397. Example
  2398. -------
  2399.      int foo[10];
  2400.      fwrite(foo, sizeof(int), 10, stdin);
  2401. File: libcref,  Node: _get_default_drive,  Next: getc,  Prev: fwrite,  Up: Alphabetical List
  2402. `_get_default_drive'
  2403. ====================
  2404. Syntax
  2405. ------
  2406.      int _get_default_drive(void);
  2407. Description
  2408. -----------
  2409. Gets the default drive.
  2410. Return Value
  2411. ------------
  2412. 0 for drive A:, 1 for drive B:, etc, up to 26 for Z:
  2413. Example
  2414. -------
  2415.      printf("Current drive is %c:\n", _get_current_drive()+'a');
  2416. File: libcref,  Node: getc,  Next: getcbrk,  Prev: _get_default_drive,  Up: Alphabetical List
  2417. `getc'
  2418. ======
  2419. Syntax
  2420. ------
  2421.      #include <stdio.h>
  2422.      
  2423.      int getc(FILE *file);
  2424. Description
  2425. -----------
  2426. Get one character from FILE.
  2427. Return Value
  2428. ------------
  2429. The character ([0..255]) or `EOF' if eof or error.
  2430. Example
  2431. -------
  2432.      int c;
  2433.      while ((c=getc(stdin)) != EOF)
  2434.        putc(c, stdout);
  2435. File: libcref,  Node: getcbrk,  Next: getchar,  Prev: getc,  Up: Alphabetical List
  2436. `getcbrk'
  2437. =========
  2438. Syntax
  2439. ------
  2440.      #include <dos.h>
  2441.      
  2442.      int getcbrk(void);
  2443. Description
  2444. -----------
  2445. Get the setting of the Ctrl-C checking flag in MS-DOS.
  2446. *Note setcbrk::
  2447. Return Value
  2448. ------------
  2449. 0 if not checking, 1 if checking.
  2450. File: libcref,  Node: getchar,  Next: getcwd,  Prev: getcbrk,  Up: Alphabetical List
  2451. `getchar'
  2452. =========
  2453. Syntax
  2454. ------
  2455.      #include <stdio.h>
  2456.      
  2457.      int getchar(void);
  2458. Description
  2459. -----------
  2460. The same as `fgetc(stdin)' (*Note fgetc::).
  2461. Return Value
  2462. ------------
  2463. The character, or `EOF'.
  2464. File: libcref,  Node: getcwd,  Next: getdate,  Prev: getchar,  Up: Alphabetical List
  2465. `getcwd'
  2466. ========
  2467. Syntax
  2468. ------
  2469.      #include <osfcn.h>
  2470.      
  2471.      char *getcwd(char *buffer, int max);
  2472. Description
  2473. -----------
  2474. Get the current directory.  The return value includes the drive
  2475. specifier.  If BUFFER is `NULL', a buffer of size MAX is allocated.
  2476. This call fails if more than MAX characters are required to specify the
  2477. current directory.
  2478. If `getcwd' allocates a buffer for you, you may later free is with
  2479. `free'.
  2480. Return Value
  2481. ------------
  2482. The buffer, either BUFFER or a newly-allocated buffer, or `NULL' on
  2483. error.
  2484. Example
  2485. -------
  2486.      char *buf = getcwd(0, PATH_MAX);
  2487.      printf("cwd is %s\n", buf);
  2488.      free(buf);
  2489. File: libcref,  Node: getdate,  Next: getdfree,  Prev: getcwd,  Up: Alphabetical List
  2490. `getdate'
  2491. =========
  2492. Syntax
  2493. ------
  2494.      #include <dos.h>
  2495.      
  2496.      void getdate(struct date *);
  2497. Description
  2498. -----------
  2499. This function gets the current date.  The return structure is as
  2500. follows:
  2501.      struct date {
  2502.        short da_year;
  2503.        char  da_day;
  2504.        char  da_mon;
  2505.      };
  2506. *Note setdate:: *Note gettime::
  2507. Return Value
  2508. ------------
  2509. None.
  2510. Example
  2511. -------
  2512.      struct date d;
  2513.      getdate(&d);
  2514. File: libcref,  Node: getdfree,  Next: getdisk,  Prev: getdate,  Up: Alphabetical List
  2515. `getdfree'
  2516. ==========
  2517. Syntax
  2518. ------
  2519.      #include <dos.h>
  2520.      
  2521.      void getdfree(unsigned char drive, struct dfree *ptr);
  2522. Description
  2523. -----------
  2524. This function gets information about the size and fullness of the given
  2525. drive (0=default, 1=A:, etc).  The return structure is as follows:
  2526.      struct dfree {
  2527.        unsigned df_avail; /* number of available clusters */
  2528.        unsigned df_total; /* total number of clusters */
  2529.        unsigned df_bsec;  /* bytes per sector */
  2530.        unsigned df_sclus; /* sectors per cluster */
  2531.      };
  2532. Return Value
  2533. ------------
  2534. None.
  2535. Example
  2536. -------
  2537.      struct dfree d;
  2538.      getdfree(3, &d); /* drive C: */
  2539. File: libcref,  Node: getdisk,  Next: getdtablesize,  Prev: getdfree,  Up: Alphabetical List
  2540. `getdisk'
  2541. =========
  2542. Syntax
  2543. ------
  2544.      #include <dir.h
  2545.      
  2546.      int getdisk(void);
  2547. Description
  2548. -----------
  2549. Gets the current disk (0=A).
  2550. *Note setdisk::
  2551. Return Value
  2552. ------------
  2553. The current disk.
  2554. Example
  2555. -------
  2556.      printf("This drive is %c:\n", getdisk() + 'A');
  2557. File: libcref,  Node: getdtablesize,  Next: getegid,  Prev: getdisk,  Up: Alphabetical List
  2558. `getdtablesize'
  2559. ===============
  2560. Syntax
  2561. ------
  2562.      #include <osfcn.h>
  2563.      
  2564.      int getdtablesize(void);
  2565. Description
  2566. -----------
  2567. Get the maximum number of open file descriptors the system supports.
  2568. Should depend on the setting of `FILES=' in `config.sys', but is
  2569. currently hardcoded to 50.
  2570. Return Value
  2571. ------------
  2572. The number of file descriptors.
  2573. File: libcref,  Node: getegid,  Next: getenv,  Prev: getdtablesize,  Up: Alphabetical List
  2574. `getegid'
  2575. =========
  2576. Syntax
  2577. ------
  2578.      #include <osfcn.h>
  2579.      
  2580.      int getegid(void);
  2581. Description
  2582. -----------
  2583. Get the effective group id.
  2584. Return Value
  2585. ------------
  2586. File: libcref,  Node: getenv,  Next: geteuid,  Prev: getegid,  Up: Alphabetical List
  2587. `getenv'
  2588. ========
  2589. Syntax
  2590. ------
  2591.      #include <stdlib.h>
  2592.      
  2593.      char *getenv(const char *name);
  2594. Description
  2595. -----------
  2596. Get the setting of the environment variable NAME.  Do not alter or free
  2597. the returned value.
  2598. Return Value
  2599. ------------
  2600. The value, or `NULL' if that variable does not exist.
  2601. Example
  2602. -------
  2603.      char *term = getenv("TERM");
  2604. File: libcref,  Node: geteuid,  Next: getftime,  Prev: getenv,  Up: Alphabetical List
  2605. `geteuid'
  2606. =========
  2607. Syntax
  2608. ------
  2609.      #include <osfcn.h>
  2610.      
  2611.      int geteuid(void);
  2612. Description
  2613. -----------
  2614. Gets the effective UID.
  2615. Return Value
  2616. ------------
  2617. File: libcref,  Node: getftime,  Next: getgid,  Prev: geteuid,  Up: Alphabetical List
  2618. `getftime'
  2619. ==========
  2620. Syntax
  2621. ------
  2622.      #include <dos.h>
  2623.      
  2624.      int getftime(int handle, struct ftime *ptr);
  2625. Description
  2626. -----------
  2627. Get the timestamp for the given file handle.  The return structure is as
  2628. follows:
  2629.      struct ftime {
  2630.        unsigned ft_tsec:5;    /* 0-29, double to get real seconds */
  2631.        unsigned ft_min:6;    /* 0-59 */
  2632.        unsigned ft_hour:5;    /* 0-23 */
  2633.        unsigned ft_day:5;    /* 1-31 */
  2634.        unsigned ft_month:4;    /* 1-12 */
  2635.        unsigned ft_year:7;    /* since 1980 */
  2636.      }
  2637. Return Value
  2638. ------------
  2639. Zero on success, nonzero on failure.
  2640. Example
  2641. -------
  2642.      struct ftime t;
  2643.      getftime(fd, &t);
  2644. File: libcref,  Node: getgid,  Next: getgrent,  Prev: getftime,  Up: Alphabetical List
  2645. `getgid'
  2646. ========
  2647. Syntax
  2648. ------
  2649.      #include <osfcn.h>
  2650.      
  2651.      int getgid(void);
  2652. Description
  2653. -----------
  2654. Get the current group id.
  2655. Return Value
  2656. ------------
  2657. File: libcref,  Node: getgrent,  Next: getgrgid,  Prev: getgid,  Up: Alphabetical List
  2658. `getgrent'
  2659. ==========
  2660. Syntax
  2661. ------
  2662.      #include <grp.h>
  2663.      
  2664.      struct group *getgrent(void);
  2665. Description
  2666. -----------
  2667. This function returns the next available group entry.  Note that for
  2668. MS-DOS, this is simulated.  If the environment variable GROUP is set,
  2669. that is the name of the only group returned, else the only group is
  2670. "other".
  2671. The return type of this and related function is as follows:
  2672.      struct group {
  2673.        char *  gr_name;   /* "other" or getenv("GROUP"); */
  2674.        char *  gr_passwd; /* "*" */
  2675.        int     gr_gid;    /* result of getgid() */
  2676.        char ** gr_mem;    /* always empty */
  2677.      };
  2678. Return Value
  2679. ------------
  2680. The next structure, or `NULL' at the end of the list.
  2681. Example
  2682. -------
  2683.      struct group *g;
  2684.      setgrent();
  2685.      while ((g = getgrent()) != NULL)
  2686.      {
  2687.        printf("group %s gid %d\n", g->gr_name, g->gr_gid);
  2688.      }
  2689.      endgrent();
  2690. File: libcref,  Node: getgrgid,  Next: getgrnam,  Prev: getgrent,  Up: Alphabetical List
  2691. `getgrgid'
  2692. ==========
  2693. Syntax
  2694. ------
  2695.      #include <grp.h>
  2696.      
  2697.      extern struct group *getgrgid(int gid);
  2698. Description
  2699. -----------
  2700. This function returns the group entry that matches GID.  *Note
  2701. getgrent::
  2702. Return Value
  2703. ------------
  2704. The matching group, or `NULL' if none match.
  2705. File: libcref,  Node: getgrnam,  Next: getgroups,  Prev: getgrgid,  Up: Alphabetical List
  2706. `getgrnam'
  2707. ==========
  2708. Syntax
  2709. ------
  2710.      #include <grp.h>
  2711.      
  2712.      struct group *getgrnam(char *name);
  2713. Description
  2714. -----------
  2715. This function returns the group entry for the group named NAME.  *Note
  2716. getgrent::
  2717. Return Value
  2718. ------------
  2719. The matching group, or `NULL' if none match.
  2720. File: libcref,  Node: getgroups,  Next: getkey,  Prev: getgrnam,  Up: Alphabetical List
  2721. `getgroups'
  2722. ===========
  2723. Description
  2724. -----------
  2725. This function is provided only to assist in porting from Unix.  It
  2726. always returns an error condition.
  2727. File: libcref,  Node: getkey,  Next: getlogin,  Prev: getgroups,  Up: Alphabetical List
  2728. `getkey'
  2729. ========
  2730. Syntax
  2731. ------
  2732.      #include <pc.h>
  2733.      #include <keys.h>
  2734.      
  2735.      int getkey(void);
  2736. Description
  2737. -----------
  2738. Waits for the user to press one key, then returns that key.  Alt-key
  2739. combinations have 0x100 added to them.  Extended keys return their
  2740. non-extended codes.
  2741. The file `keys.h' has symbolic names for many of the keys.
  2742. *Note getxkey::
  2743. Return Value
  2744. ------------
  2745. The key pressed.
  2746. Example
  2747. -------
  2748.      while (getkey() != K_Alt_3)
  2749.        do_something();
  2750. File: libcref,  Node: getlogin,  Next: getlongpass,  Prev: getkey,  Up: Alphabetical List
  2751. `getlogin'
  2752. ==========
  2753. Syntax
  2754. ------
  2755.      #include <unistd.h>
  2756.      
  2757.      char *getlogin(void);
  2758. Description
  2759. -----------
  2760. Get the login ID of the user.
  2761. Return Value
  2762. ------------
  2763. Returns the value of the `USER' environment variable, else the
  2764. `LOGNAME' environment variable, else `"dosuser"'.
  2765. Example
  2766. -------
  2767.      printf("I am %s\n", getlogin());
  2768. File: libcref,  Node: getlongpass,  Next: getmntent,  Prev: getlogin,  Up: Alphabetical List
  2769. `getlongpass'
  2770. =============
  2771. Syntax
  2772. ------
  2773.      int getlongpass(const char *prompt, char *password, int max_length);
  2774. Description
  2775. -----------
  2776. Read a password from the user.  First, the prompt is sent to `stderr'.
  2777. The characters typed are not echoed, and backspace can be used to edit
  2778. the line.  The password will be stored in PASSWORD, up to MAX_LENGTH
  2779. characters.  When the user hits Return or Enter, a newline is printed
  2780. to `stderr' and the password is returned.
  2781. Return Value
  2782. ------------
  2783. Zero on success, nonzero on failure.
  2784. Example
  2785. -------
  2786. File: libcref,  Node: getmntent,  Next: getopt,  Prev: getlongpass,  Up: Alphabetical List
  2787. `getmntent'
  2788. ===========
  2789. Syntax
  2790. ------
  2791.      #include <mntent.h>
  2792.      
  2793.      struct mntent *getmntent(FILE *filep);
  2794. Description
  2795. -----------
  2796. This function returns information about the various drives that are
  2797. available to your program.  Beginning with drive `A:', information is
  2798. retrieved for successive drives with successive calls to `getmntent'.
  2799. Note that drives `A:' and `B:' will only be returned if they are the
  2800. current drive, otherwise the first drive returned is `C:'.
  2801. This function operates by reading the volume label, so unlabelled disks
  2802. will not be available.  For each drive scanned, a pointer to a static
  2803. structure of the following type is returned:
  2804.      struct mntent
  2805.      {
  2806.          char * mnt_fsname;  /* The volume name */
  2807.          char * mnt_dir;     /* The drive name (like "c:") */
  2808.          char * mnt_type;    /* "dos" */
  2809.          char * mnt_opts;    /* "rw" */
  2810.          int    mnt_freq;    /* -1 */
  2811.          int    mnt_passno;  /* -1 */
  2812.          long   mnt_time;    /* -1 */
  2813.      };
  2814. Return Value
  2815. ------------
  2816. This function returns a pointer to an `struct' `mntent', or NULL if
  2817. there are no more drives to report on.
  2818. Example
  2819. -------
  2820.      struct mntent *m;
  2821.      FILE *f;
  2822.      f = setmntent("", "");
  2823.      while (m = getmntent(f))
  2824.        printf("Drive %s, name %s\n", m->mnt_dir, m->mnt_fsname);
  2825.      endmntent(f);
  2826. File: libcref,  Node: getopt,  Next: getpagesize,  Prev: getmntent,  Up: Alphabetical List
  2827. `getopt'
  2828. ========
  2829. Syntax
  2830. ------
  2831.      int getopt(int argc, char * const *argv, const char *options);
  2832.      extern char *optarg;
  2833.      extern int optind, opterr;
  2834.      extern char optopt;
  2835. Description
  2836. -----------
  2837. Parse options from the command line.  The OPTIONS are a string of valid
  2838. option characters.  If a given option takes a parameter, that character
  2839. should be followed by a colon.
  2840. For each valid switch, this function sets `optarg' to the argument (if
  2841. the switch takes one), sets `optind' to the index in ARGV that it is
  2842. using, sets `optopt' to the option letter found, and returns the option
  2843. letter found.
  2844. If an unexpected option is found, `getopt' will return `?', and if
  2845. `opterr' is nonzero, will print an error message to stderr.
  2846. The special option `--' indicates that no more options follow on the
  2847. command line, and cause `getopt' to stop looking.
  2848. Return Value
  2849. ------------
  2850. The option found, or -1 if no more options.
  2851. Example
  2852. -------
  2853.      int c;
  2854.      opterr = 0;
  2855.      while ((c=getopt(argc, argv, "vbf:")) != -1)
  2856.      {
  2857.        switch (c)
  2858.        {
  2859.          case 'v':
  2860.            verbose_flag ++;
  2861.            break;
  2862.          case 'b':
  2863.            binary_flag ++;
  2864.            break;
  2865.          case 'f':
  2866.            output_filename = optarg;
  2867.            break;
  2868.          case '?':
  2869.            printf("Unknown option %c\n", c);
  2870.            usage();
  2871.            exit(1);
  2872.        }
  2873.      }
  2874. File: libcref,  Node: getpagesize,  Next: getpass,  Prev: getopt,  Up: Alphabetical List
  2875. `getpagesize'
  2876. =============
  2877. Syntax
  2878. ------
  2879.      #include <osfcn.h>
  2880.      
  2881.      int getpagesize(void);
  2882. Description
  2883. -----------
  2884. Return the size of the native virtual memory page size.
  2885. Return Value
  2886. ------------
  2887. 4096 for the i386 and higher processors.
  2888. File: libcref,  Node: getpass,  Next: getpid,  Prev: getpagesize,  Up: Alphabetical List
  2889. `getpass'
  2890. =========
  2891. Syntax
  2892. ------
  2893.      #include <unistd.h>
  2894.      
  2895.      char *getpass(const char *prompt);
  2896. Description
  2897. -----------
  2898. Prompts the user with PROMPT and accepts a non-echoed password.  *Note
  2899. getlongpass::
  2900. Return Value
  2901. ------------
  2902. A pointer to a static buffer is returned.  This buffer is overridden
  2903. with each call to `getpass'.
  2904. Example
  2905. -------
  2906.      char *pw = getpass("Enter password : ");
  2907. File: libcref,  Node: getpid,  Next: getpwent,  Prev: getpass,  Up: Alphabetical List
  2908. `getpid'
  2909. ========
  2910. Syntax
  2911. ------
  2912.      #include <osfcn.h>
  2913.      
  2914.      int getpid(void);
  2915. Description
  2916. -----------
  2917. Get the process ID, which uniquely identifies each program running on
  2918. the system.
  2919. Return Value
  2920. ------------
  2921. The process ID.
  2922. File: libcref,  Node: getpwent,  Next: getpwnam,  Prev: getpid,  Up: Alphabetical List
  2923. `getpwent'
  2924. ==========
  2925. Syntax
  2926. ------
  2927.      #include <pwd.h>
  2928.      
  2929.      struct passwd *getpwent(void);
  2930. Description
  2931. -----------
  2932. This function retrieves the next available password file entry.  For
  2933. MS-DOS, this is simulated by providing exactly one entry:
  2934.      struct passwd {
  2935.        char * pw_name;    /* getlogin() */
  2936.        char * pw_passwd;  /* "*" */
  2937.        int    pw_uid;     /* getuid() */
  2938.        int    pw_gid;     /* getgid() */
  2939.        char * pw_age;     /* "" */
  2940.        char * pw_comment; /* "" */
  2941.        char * pw_gecos;   /* "DOS User" */
  2942.        char * pw_dir;     /* "/" or getenv("HOME") */
  2943.        char * pw_shell;   /* "/bin/sh" or getenv("SHELL") */
  2944.        long   pw_audid;   /* -1 */
  2945.        int    pw_audflg;  /* -1 */
  2946.      };
  2947. Return Value
  2948. ------------
  2949. The next passwd entry, or `NULL' if there are no more.
  2950. Example
  2951. -------
  2952.      struct passwd *p;
  2953.      setpwent();
  2954.      while ((p = getpwent()) != NULL)
  2955.      {
  2956.        printf("user %s name %s\n", p->pw_name, p->pw_gecos);
  2957.      }
  2958.      endpwent();
  2959. File: libcref,  Node: getpwnam,  Next: getpwuid,  Prev: getpwent,  Up: Alphabetical List
  2960. `getpwnam'
  2961. ==========
  2962. Syntax
  2963. ------
  2964.      #include <pwd.h>
  2965.      
  2966.      struct passwd *getpwnam(char *name);
  2967. Description
  2968. -----------
  2969. This function gets the password file entry matchine NAME.  *Note
  2970. getpwent::
  2971. Return Value
  2972. ------------
  2973. The matching record, or `NULL' if none match.
  2974. File: libcref,  Node: getpwuid,  Next: getrusage,  Prev: getpwnam,  Up: Alphabetical List
  2975. `getpwuid'
  2976. ==========
  2977. #include <pwd.h>
  2978. struct passwd *getpwuid(int uid);
  2979. Syntax
  2980. ------
  2981. Description
  2982. -----------
  2983. This function gets the password file entry matchine UID.  *Note
  2984. getpwent::
  2985. Return Value
  2986. ------------
  2987. The matching record, or `NULL' if none match.
  2988. File: libcref,  Node: getrusage,  Next: gets,  Prev: getpwuid,  Up: Alphabetical List
  2989. `getrusage'
  2990. ===========
  2991. Syntax
  2992. ------
  2993.      #include <sys/time.h>
  2994.      #include <sys/resource.h
  2995.      
  2996.      int getrusage(int who, struct rusage *rusage);
  2997. Description
  2998. -----------
  2999. This function returns information about the running process.  Currently,
  3000. the only field that is computed is this:
  3001.      struct rusage {
  3002.        struct timeval ru_utime;  /* total time used by process */
  3003.      };
  3004. The remainder of the fields are set to zero.
  3005. The WHO parameter must be `RUSAGE_SELF' or `RUSAGE_CHILDREN'.
  3006. Return Value
  3007. ------------
  3008. Zero on success, nonzero on failure.
  3009. Example
  3010. -------
  3011.      struct rusage r;
  3012.      getrusage(RUSAGE_SELF, &r);
  3013. File: libcref,  Node: gets,  Next: gettime,  Prev: getrusage,  Up: Alphabetical List
  3014. `gets'
  3015. ======
  3016. Syntax
  3017. ------
  3018.      #include <stdio.h>
  3019.      
  3020.      char *gets(char *buffer);
  3021. Description
  3022. -----------
  3023. Reads characters from `stdin', storing them in BUFFER, until either end
  3024. of file or a newline is encountered.  If any characters were stored,
  3025. the BUFFER is then `NULL' terminated and it's address is returned, else
  3026. `NULL' is returned.
  3027. Return Value
  3028. ------------
  3029. The address of the buffer, or `NULL'.
  3030. Example
  3031. -------
  3032.      char buf[1000];
  3033.      while (gets(buf))
  3034.        puts(buf);
  3035. File: libcref,  Node: gettime,  Next: gettimeofday,  Prev: gets,  Up: Alphabetical List
  3036. `gettime'
  3037. =========
  3038. Syntax
  3039. ------
  3040.      #include <dos.h>
  3041.      
  3042.      void gettime(struct time *);
  3043. Description
  3044. -----------
  3045. This function gets the current time.  The return structure is as
  3046. follows:
  3047.      struct time {
  3048.        unsigned char ti_min;
  3049.        unsigned char ti_hour;
  3050.        unsigned char ti_hund;
  3051.        unsigned char ti_sec;
  3052.      };
  3053. *Note settime:: *Note getdate::
  3054. Return Value
  3055. ------------
  3056. None.
  3057. Example
  3058. -------
  3059.      struct time t;
  3060.      gettime(&t);
  3061. File: libcref,  Node: gettimeofday,  Next: getuid,  Prev: gettime,  Up: Alphabetical List
  3062. `gettimeofday'
  3063. ==============
  3064. Syntax
  3065. ------
  3066.      #include <sys/time.h>
  3067.      
  3068.      int gettimeofday(struct timeval *tp, struct timezone *tzp);
  3069. Description
  3070. -----------
  3071. Gets the current GMT time and the local timezone information.  The
  3072. return structures are as follows:
  3073.      struct timeval {
  3074.        long tv_sec;  /* seconds since 00:00:00 GMT 1/1/1980 */
  3075.        long tv_usec; /* microseconds */
  3076.      };
  3077.      struct timezone {
  3078.        int tz_minuteswest; /* west of GMT */
  3079.        int tz_dsttime;     /* set if daylight saving time in affect */
  3080.      };
  3081. If either TP or TZP are `NULL', that information is not provided.
  3082. *Note settimeofday::
  3083. Return Value
  3084. ------------
  3085. Zero on success, nonzero on failure.
  3086. File: libcref,  Node: getuid,  Next: getw,  Prev: gettimeofday,  Up: Alphabetical List
  3087. `getuid'
  3088. ========
  3089. Syntax
  3090. ------
  3091.      #include <osfcn.h>
  3092.      
  3093.      int getuid(void);
  3094. Description
  3095. -----------
  3096. Returns the user ID.
  3097. Return Value
  3098. ------------
  3099. File: libcref,  Node: getw,  Next: getwd,  Prev: getuid,  Up: Alphabetical List
  3100. `getw'
  3101. ======
  3102. Syntax
  3103. ------
  3104.      #include <stdio.h>
  3105.      
  3106.      int getw(FILE *file);
  3107. Description
  3108. -----------
  3109. Reads a single binary word in native format from FILE.
  3110. *Note putw::
  3111. Return Value
  3112. ------------
  3113. The value read, or `EOF' for end-of-file or error.  Since `EOF' is a
  3114. valid integer, you should use `feof' or `ferror' to detect this
  3115. situation.
  3116. Example
  3117. -------
  3118.      int i = getw(stdin);
  3119. File: libcref,  Node: getwd,  Next: getxkey,  Prev: getw,  Up: Alphabetical List
  3120. `getwd'
  3121. =======
  3122. Syntax
  3123. ------
  3124.      #include <osfcn.h>
  3125.      
  3126.      char *getwd(char *buffer);
  3127. Description
  3128. -----------
  3129. Get the current directory and put it in BUFFER.  The return value
  3130. includes the drive specifier.
  3131. Return Value
  3132. ------------
  3133. BUFFER is returned.
  3134. Example
  3135. -------
  3136.      char buf[PATH_MAX];
  3137.      getwd(buf);
  3138. File: libcref,  Node: getxkey,  Next: gmtime,  Prev: getwd,  Up: Alphabetical List
  3139. `getxkey'
  3140. =========
  3141. Syntax
  3142. ------
  3143.      #include <pc.h>
  3144.      #include <keys.h>
  3145.      
  3146.      int getxkey(void);
  3147. Description
  3148. -----------
  3149. Waits for the user to press one key, then returns that key.  Alt-key
  3150. combinations have 0x100 added to them, and extended keys have 0x200
  3151. added to them.
  3152. The file `keys.h' has symbolic names for many of the keys.
  3153. *Note getkey::
  3154. Return Value
  3155. ------------
  3156. The key pressed.
  3157. Example
  3158. -------
  3159.      while (getxkey() != K_EEnd)
  3160.        do_something();
  3161. File: libcref,  Node: gmtime,  Next: _go32_conventional_mem_selector,  Prev: getxkey,  Up: Alphabetical List
  3162. `gmtime'
  3163. ========
  3164. Syntax
  3165. ------
  3166.      #include <time.h>
  3167.      
  3168.      struct tm *gmtime(const time_t *tod);
  3169. Description
  3170. -----------
  3171. Converts the time represented by TOD into a structure.
  3172. The return structure has this format:
  3173.      struct tm {
  3174.        int    tm_sec;    /* seconds after the minute [0-60] */
  3175.        int    tm_min;    /* minutes after the hour [0-59] */
  3176.        int    tm_hour;   /* hours since midnight [0-23] */
  3177.        int    tm_mday;   /* day of the month [1-31] */
  3178.        int    tm_mon;    /* months since January [0-11] */
  3179.        int    tm_year;   /* years since 1900 */
  3180.        int    tm_wday;   /* days since Sunday [0-6] */
  3181.        int    tm_yday;   /* days since January 1 [0-365] */
  3182.        int    tm_isdst;  /* Daylight Savings Time flag */
  3183.        long   tm_gmtoff; /* offset from GMT in seconds */
  3184.        char * tm_zone;   /* timezone abbreviation */
  3185.      };
  3186. Return Value
  3187. ------------
  3188. A pointer to a static structure which is overridden with each call.
  3189. Example
  3190. -------
  3191.      time_t x;
  3192.      struct tm *t;
  3193.      time(&x);
  3194.      t = gmtime(&t);
  3195. File: libcref,  Node: _go32_conventional_mem_selector,  Next: Go32/DPMI Information,  Prev: gmtime,  Up: Alphabetical List
  3196. `_go32_conventional_mem_selector'
  3197. =================================
  3198. Syntax
  3199. ------
  3200.      #include <go32.h>
  3201.      
  3202.      u_short _go32_conventional_mem_selector();
  3203. Description
  3204. -----------
  3205. This function returns a selector which has a physical base address
  3206. corresponding to the beginning of conventional memory.  This selector
  3207. can be used as a parameter to `movedata' (*Note movedata::) to
  3208. manipulate memory in the conventional address space.
  3209. Return Value
  3210. ------------
  3211. The selector.
  3212. Example
  3213. -------
  3214.      short blank_row_buf[ScreenCols()];
  3215.      /* scroll screen */
  3216.      movedata(_go32_conventional_mem_selector(), 0xb8000 + ScreenCols()*2,
  3217.               _go32_conventional_mem_selector(), 0xb8000,
  3218.               ScreenCols() * (ScreenRows()-1) * 2);
  3219.      /* fill last row */
  3220.      movedata(_go32_my_ds, (int)blank_row_buf,
  3221.               _go32_conventional_mem_selector(),
  3222.                  0xb8000 + ScreenCols()*(ScreenRows()-1)*2,
  3223.                ScreenCols() * 2);
  3224. File: libcref,  Node: Go32/DPMI Information,  Next: _go32_dpmi_allocate_dos_memory,  Prev: _go32_conventional_mem_selector,  Up: Alphabetical List
  3225. GO32/DPMI structures
  3226. ====================
  3227. Syntax
  3228. ------
  3229.      #include <dpmi.h>
  3230. Description
  3231. -----------
  3232. DPMI is an interface to the program controlling the protected mode of
  3233. the PC.  For more information on DPMI, order Intel document number
  3234. 240977-001.  If there is no DPMI server running on the PC, go32 itself
  3235. will provide a subset of the DPMI functions.  For maximum portability,
  3236. programs should confine themselves to the specifications listed in the
  3237. file `docs/djgpp/dpmi.doc' in the DJGPP distribution.  The convenience
  3238. functions listed in `include/dpmi.h' comply with these restrictions and
  3239. thus will always be usable on a given PC.
  3240. The DPMI convenience functions provided by go32 use two structures to
  3241. pass information around in.  These structures are shown below.
  3242.      typedef union {
  3243.        struct {
  3244.          u_long edi;
  3245.          u_long esi;
  3246.          u_long ebp;
  3247.          u_long res;
  3248.          u_long ebx;
  3249.          u_long edx;
  3250.          u_long ecx;
  3251.          u_long eax;
  3252.        } d;
  3253.        struct {
  3254.          u_short di, di_hi;
  3255.          u_short si, si_hi;
  3256.          u_short bp, bp_hi;
  3257.          u_short res, res_hi;
  3258.          u_short bx, bx_hi;
  3259.          u_short dx, dx_hi;
  3260.          u_short cx, cx_hi;
  3261.          u_short ax, ax_hi;
  3262.          u_short flags;
  3263.          u_short es;
  3264.          u_short ds;
  3265.          u_short fs;
  3266.          u_short gs;
  3267.          u_short ip;
  3268.          u_short cs;
  3269.          u_short sp;
  3270.          u_short ss;
  3271.        } x;
  3272.        struct {
  3273.          u_char edi[4];
  3274.          u_char esi[4];
  3275.          u_char ebp[4];
  3276.          u_char res[4];
  3277.          u_char bl, bh, ebx_b2, ebx_b3;
  3278.          u_char dl, dh, edx_b2, edx_b3;
  3279.          u_char cl, ch, ecx_b2, ecx_b3;
  3280.          u_char al, ah, eax_b2, eax_b3;
  3281.        } h;
  3282.      } _go32_dpmi_registers;
  3283. The `_go32_dpmi_regisers' structure is used to pass a CPU state image
  3284. between protected and real mode.
  3285.      typedef struct {
  3286.        u_long  size;
  3287.        u_long  pm_offset;
  3288.        u_short pm_selector;
  3289.        u_short rm_offset;
  3290.        u_short rm_segment;
  3291.      } _go32_dpmi_seginfo;
  3292. The `_go32_dpmi_seginfo' structure is used to pass information about
  3293. protected mode and real mode pointers to the convenience functions.
  3294. Unless stated otherwise, you should not modify any field in this
  3295. structure.  Many calls store important information in otherwise unused
  3296. fields that is used in cleanup-style functions.  For example,
  3297. `_go32_dpmi_allocate_dos_memory' stores a value in pm_selector that is
  3298. only used by `_go32_dpmi_free_dos_memory'.
  3299. File: libcref,  Node: _go32_dpmi_allocate_dos_memory,  Next: _go32_dpmi_allocate_iret_wrapper,  Prev: Go32/DPMI Information,  Up: Alphabetical List
  3300. `_go32_dpmi_allocate_dos_memory'
  3301. ================================
  3302. Syntax
  3303. ------
  3304.      #include <dpmi.h>
  3305.      
  3306.      int _go32_dpmi_allocate_dos_memory(_go32_dpmi_seginfo *info);
  3307. Description
  3308. -----------
  3309. *Note Go32/DPMI Information::
  3310. Allocate a part of the conventional memory area (the first 640K).  Set
  3311. the `size' field of INFO to the number of paragraphs requested (this is
  3312. (size in bytes + 15)/16), then call.  The `rm_segment' field of INFO
  3313. contains the segment of the allocated memory.
  3314. The memory may be resized with `_go32_dpmi_resize_dos_memory' and must
  3315. be freed with `_go32_dpmi_free_dos_memory'.
  3316. If there isn't enough memory in the system, the `size' field of INFO
  3317. has the largest available size, and an error is returned.
  3318. *Note dosmemput:: *Note dosmemget::
  3319. Return Value
  3320. ------------
  3321. Zero on success, nonzero on failure.
  3322. Example
  3323. -------
  3324.      _go32_dpmi_seginfo info;
  3325.      info.size = (want_size+15) / 16;
  3326.      _go32_dpmi_allocate_dos_memory(&info);
  3327.      dosmemput(buffer, info.rm_segment*16, want_size);
  3328.      _go32_dpmi_free_dos_memory(&info);
  3329. File: libcref,  Node: _go32_dpmi_allocate_iret_wrapper,  Next: _go32_dpmi_allocate_real_mode_callback_iret,  Prev: _go32_dpmi_allocate_dos_memory,  Up: Alphabetical List
  3330. `_go32_dpmi_allocate_iret_wrapper'
  3331. ==================================
  3332. Syntax
  3333. ------
  3334.      #include <dpmi.h>
  3335.      
  3336.      int _go32_dpmi_allocate_iret_wrapper(_go32_dpmi_seginfo *info);
  3337. Description
  3338. -----------
  3339. *Note Go32/DPMI Information::
  3340. This function creates a small assembler function that handles the
  3341. overhead of servicing an interrupt.  To use, put the address of your
  3342. servicing function in the `pm_offset' field of INFO and call this
  3343. function.  The `pm_field' will get replaced with the address of the
  3344. wrapper function, which you pass to both
  3345. `_go32_dpmi_set_protected_mode_interrupt_vector' and
  3346. `_go32_dpmi_free_iret_wrapper'.
  3347. *Note _go32_dpmi_set_protected_mode_interrupt_vector:: *Note
  3348. _go32_dpmi_free_iret_wrapper::
  3349. Return Value
  3350. ------------
  3351. Zero on success, nonzero on failure.
  3352. Example
  3353. -------
  3354.      _go32_dpmi_seginfo info;
  3355.      info.pm_offset = my_handler;
  3356.      _go32_dpmi_allocate_iret_wrapper(&info);
  3357.      _go32_set_protected_mode_interrupt_handler(0x75, &info);
  3358.      ...
  3359.      _go32_dpmi_free_iret_wrapper(&info);
  3360. File: libcref,  Node: _go32_dpmi_allocate_real_mode_callback_iret,  Next: _go32_dpmi_allocate_real_mode_callback_retf,  Prev: _go32_dpmi_allocate_iret_wrapper,  Up: Alphabetical List
  3361. `_go32_dpmi_allocate_real_mode_callback_iret'
  3362. =============================================
  3363. Syntax
  3364. ------
  3365.      #include <dpmi.h>
  3366.      
  3367.      int _go32_dpmi_allocate_real_mode_callback_iret(_go32_dpmi_seginfo *info, _go32_dpmi_registers *regs);
  3368. Description
  3369. -----------
  3370. *Note Go32/DPMI Information::
  3371. This function allocates a "real-mode callback".  Fill in the
  3372. `pm_offset' field of INFO and call this function.  It will fill in the
  3373. `rm_segment' and `rm_offset' fields.  Any time a real-mode program
  3374. calls the real-mode address, your function gets called.  The registers
  3375. in affect will be stored in REGS, which should be a global, and will be
  3376. passed to your function.  Any changes in REGS will be reflected back
  3377. into real mode.  A wrapper will be added to your function to simulate
  3378. the effects of an `iret' instruction, so this function is useful for
  3379. trapping real-mode software interrupts (like 0x1b - `Ctrl-Break' hit).
  3380. Return Value
  3381. ------------
  3382. Zero on success, nonzero on failure.
  3383. Example
  3384. -------
  3385.      _go32_dpmi_registers regs;
  3386.      
  3387.      my_handler(_go32_dpmi_registers *r)
  3388.      {
  3389.        r.d.eax = 4;
  3390.      }
  3391.      
  3392.      setup()
  3393.      {
  3394.        _go32_dpmi_seginfo info;
  3395.        _go32_dpmi_seginfo old_vector;
  3396.        _go32_get_real_mode_interrupt_vector(0x84, &old_vector);
  3397.        info.pm_offset = my_handler;
  3398.        _go32_allocate_real_mode_callback_iret(&info, ®s);
  3399.        _go32_set_real_mode_interrupt_vector(0x84, &info);
  3400.        do_stuff();
  3401.        _go32_set_real_mode_interrupt_vector(0x84, &old_vector);
  3402.        _go32_free_real_mode_callback(&info);
  3403.      }
  3404. File: libcref,  Node: _go32_dpmi_allocate_real_mode_callback_retf,  Next: _go32_dpmi_chain_protected_mode_interrupt_vector,  Prev: _go32_dpmi_allocate_real_mode_callback_iret,  Up: Alphabetical List
  3405. `_go32_dpmi_allocate_real_mode_callback_retf'
  3406. =============================================
  3407. Syntax
  3408. ------
  3409.      #include <dpmi.h>
  3410.      
  3411.      int _go32_dpmi_allocate_real_mode_callback_retf(_go32_dpmi_seginfo *info, _go32_dpmi_registers *regs);
  3412. Description
  3413. -----------
  3414. *Note Go32/DPMI Information::
  3415. This function allocates a "real-mode callback".  Fill in the
  3416. `pm_offset' field of INFO and call this function.  It will fill in the
  3417. `rm_segment' and `rm_offset' fields.  Any time a real-mode program
  3418. calls the real-mode address, your function gets called.  The registers
  3419. in affect will be stored in REGS, which should be a global, and will be
  3420. passed to your function.  Any changes in REGS will be reflected back
  3421. into real mode.  A wrapper will be added to your function to simulate
  3422. the effects of a far return, such as the callback for the packet driver
  3423. receiver.
  3424. Return Value
  3425. ------------
  3426. Zero on success, nonzero on failure.
  3427. Example
  3428. -------
  3429. *Note _go32_dpmi_allocate_real_mode_callback_iret::
  3430. File: libcref,  Node: _go32_dpmi_chain_protected_mode_interrupt_vector,  Next: _go32_dpmi_free_dos_memory,  Prev: _go32_dpmi_allocate_real_mode_callback_retf,  Up: Alphabetical List
  3431. `_go32_dpmi_chain_protected_mode_interrupt_vector'
  3432. ==================================================
  3433. Syntax
  3434. ------
  3435.      #include <dpmi.h>
  3436.      
  3437.      int _go32_dpmi_chain_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  3438. Description
  3439. -----------
  3440. *Note Go32/DPMI Information::
  3441. This function is used to chain a protected mode interrupt.  It will
  3442. build a suitable wrapper that will call your function and then jump to
  3443. the next handler.  Your function need not perform any special handling.
  3444. *Warning!* Because of the way DPMI works, you may *not* `longjmp' out
  3445. of an interrupt handler or perform any system calls (such as `printf')
  3446. from within an interrupt handler.
  3447. Return Value
  3448. ------------
  3449. Zero on success, nonzero on failure.
  3450. Example
  3451. -------
  3452. *Note _go32_dpmi_set_protected_mode_interrupt_vector::
  3453. File: libcref,  Node: _go32_dpmi_free_dos_memory,  Next: _go32_dpmi_free_iret_wrapper,  Prev: _go32_dpmi_chain_protected_mode_interrupt_vector,  Up: Alphabetical List
  3454. `_go32_dpmi_free_dos_memory'
  3455. ============================
  3456. Syntax
  3457. ------
  3458.      #include <dpmi.h>
  3459.      
  3460.      int _go32_dpmi_free_dos_memory(_go32_dpmi_seginfo *info);
  3461. Description
  3462. -----------
  3463. *Note Go32/DPMI Information::
  3464. This function frees the conventional memory allocated by
  3465. `_go32_dpmi_allocate_real_mode_memory'.  You should pass it the same
  3466. structure as was used to allocate it.
  3467. Return Value
  3468. ------------
  3469. Zero on success, nonzero on failure.
  3470. Example
  3471. -------
  3472.      _go32_dpmi_seginfo info;
  3473.      info.size = 100;
  3474.      _go32_dpmi_allocate_dos_memory(&info);
  3475.      _go32_dpmi_free_dos_memory(&info);
  3476. File: libcref,  Node: _go32_dpmi_free_iret_wrapper,  Next: _go32_dpmi_free_real_mode_callback,  Prev: _go32_dpmi_free_dos_memory,  Up: Alphabetical List
  3477. `_go32_dpmi_free_iret_wrapper'
  3478. ==============================
  3479. Syntax
  3480. ------
  3481.      #include <dpmi.h>
  3482.      
  3483.      int _go32_dpmi_free_iret_wrapper(_go32_dpmi_seginfo *info);
  3484. Description
  3485. -----------
  3486. *Note Go32/DPMI Information::
  3487. This function frees the memory used by the wrapper created by
  3488. `_go32_dpmi_allocate_iret_wrapper'.  You should not free a wrapper that
  3489. is still in use.
  3490. Return Value
  3491. ------------
  3492. Zero on success, nonzero on failure.
  3493. Example
  3494. -------
  3495. *Note _go32_dpmi_allocate_iret_wrapper::
  3496. File: libcref,  Node: _go32_dpmi_free_real_mode_callback,  Next: _go32_dpmi_get_free_memory_information,  Prev: _go32_dpmi_free_iret_wrapper,  Up: Alphabetical List
  3497. `_go32_dpmi_free_real_mode_callback'
  3498. ====================================
  3499. Syntax
  3500. ------
  3501.      #include <dpmi.h>
  3502.      
  3503.      int _go32_dpmi_free_real_mode_callback(_go32_dpmi_seginfo *info);
  3504. Description
  3505. -----------
  3506. *Note Go32/DPMI Information::
  3507. This function frees the real-mode callbacks and wrappers allocated by
  3508. `_go32_dpmi_allocate_real_mode_callback_iret' and
  3509. `_go32_dpmi_allocate_real_mode_callback_retf'.
  3510. Return Value
  3511. ------------
  3512. Zero on success, nonzero on failure.
  3513. Example
  3514. -------
  3515. *Note _go32_dpmi_allocate_real_mode_callback_iret::
  3516. File: libcref,  Node: _go32_dpmi_get_free_memory_information,  Next: _go32_dpmi_get_protected_mode_interrupt_vector,  Prev: _go32_dpmi_free_real_mode_callback,  Up: Alphabetical List
  3517. `_go32_dpmi_get_free_memory_information'
  3518. ========================================
  3519. Syntax
  3520. ------
  3521.      #include <dpmi.h
  3522.      
  3523.      int _go32_dpmi_get_free_memory_information(_go32_dpmi_meminfo *info);
  3524. Description
  3525. -----------
  3526. This function fills in the following structure:
  3527.      typedef struct {
  3528.        u_long available_memory;
  3529.        u_long available_pages;
  3530.        u_long available_lockable_pages;
  3531.        u_long linear_space;
  3532.        u_long unlocked_pages;
  3533.        u_long available_physical_pages;
  3534.        u_long total_physical_pages;
  3535.        u_long free_linear_space;
  3536.        u_long max_pages_in_paging_file;
  3537.        u_long reserved[3];
  3538.      } _go32_dpmi_meminfo;
  3539. The only field that is guaranteed to have useful data is
  3540. `available_memory'.  Any unavailable field has -1 in it.
  3541. Return Value
  3542. ------------
  3543. Zero on success, nonzero on failure.
  3544. Example
  3545. -------
  3546.      int phys_mem_left()
  3547.      {
  3548.        _go32_dpmi_meminfo info;
  3549.        _go32_dpmi_get_free_memory_information(&info);
  3550.        if (info.available_physical_pages != -1)
  3551.          return info.available_physical_pages * 4096;
  3552.        return info.available_memory;
  3553.      }
  3554. File: libcref,  Node: _go32_dpmi_get_protected_mode_interrupt_vector,  Next: _go32_dpmi_get_real_mode_interrupt_vector,  Prev: _go32_dpmi_get_free_memory_information,  Up: Alphabetical List
  3555. `_go32_dpmi_get_protected_mode_interrupt_vector'
  3556. ================================================
  3557. Syntax
  3558. ------
  3559.      #include <dpmi.h>
  3560.      
  3561.      int _go32_dpmi_get_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  3562. Description
  3563. -----------
  3564. *Note Go32/DPMI Information::
  3565. This function puts the selector and offset of the specified interrupt
  3566. vector into the `pm_selector' and `pm_offset' fields of INFO.  This
  3567. structure can be saved and later passed to
  3568. `_go32_dpmi_get_protected_mode_interrupt_vector' to restore a vector.
  3569. Return Value
  3570. ------------
  3571. Zero on success, nonzero on failure.
  3572. Example
  3573. -------
  3574. *Note _go32_dpmi_set_protected_mode_interrupt_vector::
  3575. File: libcref,  Node: _go32_dpmi_get_real_mode_interrupt_vector,  Next: _go32_dpmi_remaining_physical_memory,  Prev: _go32_dpmi_get_protected_mode_interrupt_vector,  Up: Alphabetical List
  3576. `_go32_dpmi_get_real_mode_interrupt_vector'
  3577. ===========================================
  3578. Syntax
  3579. ------
  3580.      #include <dpmi.h>
  3581.      
  3582.      int _go32_dpmi_get_real_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  3583. Description
  3584. -----------
  3585. *Note Go32/DPMI Information::
  3586. This function fills in the `rm_segment' and `rm_offset' fields of INFO
  3587. with the address of the specified real-mode interrupt vector.
  3588. Return Value
  3589. ------------
  3590. Zero on success, nonzero on failure.
  3591. Example
  3592. -------
  3593. *Note _go32_dpmi_allocate_real_mode_callback_iret::
  3594. File: libcref,  Node: _go32_dpmi_remaining_physical_memory,  Next: _go32_dpmi_remaining_virtual_memory,  Prev: _go32_dpmi_get_real_mode_interrupt_vector,  Up: Alphabetical List
  3595. `_go32_dpmi_remaining_physical_memory'
  3596. ======================================
  3597. Syntax
  3598. ------
  3599.      #include <dpmi.h>
  3600.      
  3601.      u_long _go32_dpmi_remaining_physical_memory();
  3602. Description
  3603. -----------
  3604. Returns the amount of physical memory that is still available in the
  3605. system.
  3606. Return Value
  3607. ------------
  3608. The amount in bytes.
  3609. File: libcref,  Node: _go32_dpmi_remaining_virtual_memory,  Next: _go32_dpmi_resize_dos_memory,  Prev: _go32_dpmi_remaining_physical_memory,  Up: Alphabetical List
  3610. `_go32_dpmi_remaining_virtual_memory'
  3611. =====================================
  3612. Syntax
  3613. ------
  3614.      #include <dpmi.h>
  3615.      
  3616.      u_long _go32_dpmi_remaining_virtual_memory();
  3617. Description
  3618. -----------
  3619. Returns the amount of virtual memory that is still available in the
  3620. system.
  3621. Return Value
  3622. ------------
  3623. The amount in bytes.
  3624. File: libcref,  Node: _go32_dpmi_resize_dos_memory,  Next: _go32_dpmi_set_protected_mode_interrupt_vector,  Prev: _go32_dpmi_remaining_virtual_memory,  Up: Alphabetical List
  3625. `_go32_dpmi_resize_dos_memory'
  3626. ==============================
  3627. Syntax
  3628. ------
  3629.      #include <dpmi.h>
  3630.      
  3631.      int _go32_dpmi_resize_dos_memory(_go32_dpmi_seginfo *info);
  3632. Description
  3633. -----------
  3634. *Note Go32/DPMI Information::
  3635. The INFO structure is the same one used to allocate the memory.  Fill
  3636. in a new value for `size' and call this function.  If there is not
  3637. enough memory to satisfy the request, the largest size is filled in to
  3638. the `size' field, the memory is not resized, and this function fails.
  3639. Return Value
  3640. ------------
  3641. Zero on success, nonzero on failure.
  3642. Example
  3643. -------
  3644.      _go32_dpmi_seginfo info;
  3645.      info.size = 10;
  3646.      _go32_dpmi_allocate_dos_memory(&info);
  3647.      info.size = 20;
  3648.      _go32_dpmi_resize_dos_memory(&info);
  3649.      _go32_dpmi_free_dos_memory(&info);
  3650. File: libcref,  Node: _go32_dpmi_set_protected_mode_interrupt_vector,  Next: _go32_dpmi_set_real_mode_interrupt_vector,  Prev: _go32_dpmi_resize_dos_memory,  Up: Alphabetical List
  3651. `_go32_dpmi_set_protected_mode_interrupt_vector'
  3652. ================================================
  3653. Syntax
  3654. ------
  3655.      #include <dpmi.h>
  3656.      
  3657.      int _go32_dpmi_set_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  3658. Description
  3659. -----------
  3660. *Note Go32/DPMI Information::
  3661. This function sets the protected mode interrupt vector specified to
  3662. point to the given function.  The `pm_offset' and `pm_selector' fields
  3663. of INFO must be filled in (*Note _go32_my_cs::).  The following should
  3664. be noted:
  3665.    *  You may not `longjmp' out of an interrupt handler.
  3666.    *  You may not make any function calls that require go32's
  3667.      assistance, such as `printf'.
  3668.    *  This function will not wrap the handler for you.  The
  3669.      `_go32_dpmi_allocate_iret_wrapper' and
  3670.      `_go32_dpmi_chain_protected_mode_interrupt_vector' functions can
  3671.      wrap your function if you want.
  3672.    *  You must set the pm_selector field of INFO.  Use `_go32_my_cs' to
  3673.      get a selector valid for your functions.
  3674. Return Value
  3675. ------------
  3676. Zero on success, nonzero on failure.
  3677. Example
  3678. -------
  3679.      volatile int tics = 0;
  3680.      
  3681.      timer_handler()
  3682.      {
  3683.        tics++;
  3684.      }
  3685.      
  3686.      int main()
  3687.      {
  3688.        _go32_dpmi_seginfo old_handler, new_handler;
  3689.      
  3690.        printf("grabbing timer interrupt\n");
  3691.        _go32_dpmi_get_protected_mode_interrupt_vector(8, &old_handler);
  3692.      
  3693.        new_handler.pm_offset = (int)tic_handler;
  3694.        new_handler.pm_selector = _go32_my_cs();
  3695.        _go32_dpmi_chain_protected_mode_interrupt_vector(8, &new_handler);
  3696.      
  3697.        getkey();
  3698.      
  3699.        printf("releasing timer interrupt\n");
  3700.        _go32_dpmi_set_protected_mode_interrupt_vector(8, &old_handler);
  3701.      
  3702.        return 0;
  3703.      }
  3704. File: libcref,  Node: _go32_dpmi_set_real_mode_interrupt_vector,  Next: _go32_dpmi_simulate_fcall,  Prev: _go32_dpmi_set_protected_mode_interrupt_vector,  Up: Alphabetical List
  3705. `_go32_dpmi_set_real_mode_interrupt_vector'
  3706. ===========================================
  3707. Syntax
  3708. ------
  3709.      #include <dpmi.h>
  3710.      
  3711.      int _go32_dpmi_set_real_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  3712. Description
  3713. -----------
  3714. *Note Go32/DPMI Information::
  3715. This function sets the real-mode interrupt vector specified to point to
  3716. the address in the `rm_segment' and `rm_offset' fields in INFO.
  3717. Return Value
  3718. ------------
  3719. Zero on success, nonzero on failure.
  3720. Example
  3721. -------
  3722. *Note _go32_dpmi_allocate_real_mode_callback_iret::
  3723. File: libcref,  Node: _go32_dpmi_simulate_fcall,  Next: _go32_dpmi_simulate_fcall_iret,  Prev: _go32_dpmi_set_real_mode_interrupt_vector,  Up: Alphabetical List
  3724. `_go32_dpmi_simulate_fcall'
  3725. ===========================
  3726. Syntax
  3727. ------
  3728.      #include <dpmi.h>
  3729.      
  3730.      int _go32_dpmi_simulate_fcall(_go32_dpmi_registers *regs);
  3731. Description
  3732. -----------
  3733. *Note Go32/DPMI Information::
  3734. This function simulates a real-mode far call to a function that returns
  3735. with a far return.  The registers are set up from REGS, including `CS'
  3736. and `IP', which indicate the address of the call.  Any registers the
  3737. function modifies are reflected in REGS on return.
  3738. If `SS' and `SP' are both zero, a small temporary stack is used when in
  3739. real mode.
  3740. Return Value
  3741. ------------
  3742. Zero on success, nonzero on failure.
  3743. Example
  3744. -------
  3745.      _go32_dpmi_registers r;
  3746.      r.x.ax = 47;
  3747.      r.x.cs = some_segment;
  3748.      r.x.ip = some_offset;
  3749.      r.x.ss = r.x.sp = 0;
  3750.      _go32_simulate_fcall(&r);
  3751.      printf("returns %d\n", r.x.ax);
  3752. File: libcref,  Node: _go32_dpmi_simulate_fcall_iret,  Next: _go32_dpmi_simulate_int,  Prev: _go32_dpmi_simulate_fcall,  Up: Alphabetical List
  3753. `_go32_dpmi_simulate_fcall_iret'
  3754. ================================
  3755. Syntax
  3756. ------
  3757.      #include <dpmi.h>
  3758.      
  3759.      int _go32_dpmi_simulate_fcall_iret(_go32_dpmi_registers *regs);
  3760. Description
  3761. -----------
  3762. *Note Go32/DPMI Information::
  3763. This function simulates a real-mode far call to a function that returns
  3764. with an `iret' instruction.  The registers are set up from REGS,
  3765. including `CS' and `IP', which indicate the address of the call.  Any
  3766. registers the function modifies are reflected in REGS on return.
  3767. If `SS' and `SP' are both zero, a small temporary stack is used when in
  3768. real mode.
  3769. Return Value
  3770. ------------
  3771. Zero on success, nonzero on failure.
  3772. Example
  3773. -------
  3774.      _go32_dpmi_registers r;
  3775.      r.x.ax = 47;
  3776.      r.x.cs = some_segment;
  3777.      r.x.ip = some_offset;
  3778.      r.x.ss = r.x.sp = 0;
  3779.      _go32_simulate_fcall(&r);
  3780.      printf("returns %d\n", r.x.ax);
  3781. File: libcref,  Node: _go32_dpmi_simulate_int,  Next: _go32_info_block,  Prev: _go32_dpmi_simulate_fcall_iret,  Up: Alphabetical List
  3782. `_go32_dpmi_simulate_int'
  3783. =========================
  3784. Syntax
  3785. ------
  3786.      #include <dpmi.h>
  3787.      
  3788.      int _go32_dpmi_simulate_int(int vector, _go32_dpmi_registers *regs);
  3789. Description
  3790. -----------
  3791. *Note Go32/DPMI Information::
  3792. This function simulates a real-mode interrup.  The registers are set up
  3793. from REGS, including `CS' and `IP', which indicate the address of the
  3794. call.  Any registers the function modifies are reflected in REGS on
  3795. return.
  3796. If `SS' and `SP' are both zero, a small temporary stack is used when in
  3797. real mode.
  3798. Return Value
  3799. ------------
  3800. Zero on success, nonzero on failure.
  3801. Example
  3802. -------
  3803.      _go32_dpmi_registers r;
  3804.      r.h.ah = 0x08;
  3805.      r.h.dl = 0x80; /* drive C: */
  3806.      r.x.ss = r.x.sp = 0;
  3807.      _go32_simulate_int(0x13, &r);
  3808.      printf("disk is %d cyl, %d head, %d sect\n",
  3809.             r.h.ch | ((r.x.cl<<2)&0x300),
  3810.             r.h.dh, r.h.cl & 0x3f));
  3811. File: libcref,  Node: _go32_info_block,  Next: _go32_my_cs,  Prev: _go32_dpmi_simulate_int,  Up: Alphabetical List
  3812. `_go32_info_block'
  3813. ==================
  3814. Syntax
  3815. ------
  3816.      #include <go32.h>
  3817.      
  3818.      extern Go32_Info_Block _go32_info_block;
  3819. Description
  3820. -----------
  3821. The go32 information block is a mechanism for `go32' to pass
  3822. information to the application.  Some of this information is generally
  3823. useful, such as the pid or the transfer buffer, while some is used
  3824. internally to `libc.a' only.
  3825. The structure has this format:
  3826.      typedef struct {
  3827.        u_long size_of_this_structure_in_bytes;
  3828.        u_long linear_address_of_primary_screen;
  3829.        u_long linear_address_of_secondary_screen;
  3830.        u_long linear_address_of_transfer_buffer;
  3831.        u_long size_of_transfer_buffer;
  3832.        u_long pid;
  3833.        u_char master_interrupt_controller_base;
  3834.        u_char slave_interrupt_controller_base;
  3835.        u_short selector_for_linear_memory;
  3836.        u_long linear_address_of_stub_info_structure;
  3837.        u_long linear_address_of_original_psp;
  3838.        u_short run_mode;
  3839.        u_short run_mode_info;
  3840.      } Go32_Info_Block;
  3841. The linear address fields provide values that are suitable for
  3842. `dosmemget' and `dosmemput'.
  3843. The `run_mode' field indicates the mode that the program is running in.
  3844. The following modes are defined:
  3845. `_GO32_RUN_MODE_UNDEF'
  3846.      This indicates that the extender did not (or could not) determine
  3847.      or provide the mode information.  The most probable reason is that
  3848.      it's an older extender that does not support this field.  The
  3849.      program should not assume anything about the run mode if it is
  3850.      this value.
  3851. `_GO32_RUN_MODE_RAW'
  3852.      This indicates that no CPU manager is being used, and no XMS
  3853.      manager is present.  The CPU is being managed directly from the
  3854.      extender, and memory was allocated from the extended memory pool.
  3855. `_GO32_RUN_MODE_XMS'
  3856.      This indicates that the extender is managing the CPU, but an XMS
  3857.      driver is managing the memory pool.
  3858. `_GO32_RUN_MODE_VCPI'
  3859.      This indicates that a VCPI server (like `emm386' or `qemm') is
  3860.      managing both the CPU and the memory.
  3861. `_GO32_RUN_MODE_DPMI'
  3862.      This indicates that a DPMI server (like `qdpmi' or Windows) is
  3863.      managing both the CPU and memory.  Programs may rely on this value
  3864.      to determine if it is safe to use DPMI 0.9 functions.
  3865.      If this value is set, the `run_mode_info' field has the DPMI
  3866.      specification version, in hex, shifted eight bits.  For example,
  3867.      DPMI 0.9 has 0x0090 in the `run_mode_info' field.
  3868. Note that the program should not assume that the value will be one of
  3869. the listed values.  If the program is running with an extender that
  3870. provides some other mode (say, a newly released extender) then the
  3871. program should be able to handle that case gracefully.
  3872. Example
  3873. -------
  3874.      dosmemget(_go32_info_block.linear_address_of_primary_screen, 80*25*2, buf);
  3875. File: libcref,  Node: _go32_my_cs,  Next: _go32_my_ds,  Prev: _go32_info_block,  Up: Alphabetical List
  3876. `_go32_my_cs'
  3877. =============
  3878. Syntax
  3879. ------
  3880.      #include <go32.h>
  3881.      
  3882.      u_short _go32_my_cs();
  3883. Description
  3884. -----------
  3885. Returns the current `CS'.  This is useful for setting up interrupt
  3886. vectors and such.
  3887. Return Value
  3888. ------------
  3889. File: libcref,  Node: _go32_my_ds,  Next: _go32_my_ss,  Prev: _go32_my_cs,  Up: Alphabetical List
  3890. `_go32_my_ds'
  3891. =============
  3892. Syntax
  3893. ------
  3894.      #include <go32.h>
  3895.      
  3896.      u_short _go32_my_ds();
  3897. Description
  3898. -----------
  3899. Returns the current `DS'.  This is useful for setting up interrupt
  3900. handlers and such.
  3901. Return Value
  3902. ------------
  3903. File: libcref,  Node: _go32_my_ss,  Next: _go32_want_ctrl_break,  Prev: _go32_my_ds,  Up: Alphabetical List
  3904. `_go32_my_ss'
  3905. =============
  3906. Syntax
  3907. ------
  3908.      #include <go32.h>
  3909.      
  3910.      u_short _go32_my_ss();
  3911. Description
  3912. -----------
  3913. Returns the current `SS'.  This is useful for setting up interrupt
  3914. handlers and such.
  3915. Return Value
  3916. ------------
  3917. File: libcref,  Node: _go32_want_ctrl_break,  Next: _go32_was_ctrl_break_hit,  Prev: _go32_my_ss,  Up: Alphabetical List
  3918. `_go32_want_ctrl_break'
  3919. =======================
  3920. Syntax
  3921. ------
  3922.      #include <go32.h>
  3923.      
  3924.      void   _go32_want_ctrl_break(int yes);
  3925. Description
  3926. -----------
  3927. This function tells go32 whether or not it wants `Ctrl-Break' to be an
  3928. exception or passed to the application.  If you pass a nonzero value
  3929. for YES, pressing `Ctrl-Break' will set a flag that can be detected
  3930. with `_go32_was_ctrl_break_hit' (*Note _go32_was_ctrl_break_hit::).  If
  3931. you pass zero for YES, When you press `Ctrl-Break' the program will be
  3932. terminated.
  3933. Note that if you call `_go32_was_ctrl_break_hit', this function
  3934. automatically gets called to ask for `Ctrl-Break' events.
  3935. Return Value
  3936. ------------
  3937. None.
  3938. Example
  3939. -------
  3940.      _g32_want_ctrl_break(1);
  3941.      do_something_long();
  3942.      _g32_want_ctrl_break(0);
  3943. File: libcref,  Node: _go32_was_ctrl_break_hit,  Next: hasmntopt,  Prev: _go32_want_ctrl_break,  Up: Alphabetical List
  3944. `_go32_was_ctrl_break_hit'
  3945. ==========================
  3946. Syntax
  3947. ------
  3948.      #include <go32.h>
  3949.      
  3950.      u_long _go32_was_ctrl_break_hit();
  3951. Description
  3952. -----------
  3953. This function returns the number of times that `Ctrl-Break' was hit
  3954. since the last call to this function or `_go32_want_ctrl_break' (*Note
  3955. _go32_want_ctrl_break::).
  3956. Return Value
  3957. ------------
  3958. Zero if `Ctrl-Break' hasn't been hit, nonzero to indicate how many
  3959. times if it has been hit.
  3960. Note that `_go32_want_ctrl_break' is automatically called to request
  3961. these events, so you don't have to set up for this call.
  3962. Example
  3963. -------
  3964.      while (!_go32_was_ctrl_break_hit())
  3965.        do_something();
  3966. File: libcref,  Node: hasmntopt,  Next: htonl,  Prev: _go32_was_ctrl_break_hit,  Up: Alphabetical List
  3967. `hasmntopt'
  3968. ===========
  3969. Syntax
  3970. ------
  3971.      #include <mntent.h>
  3972.      
  3973.      char *hasmntopt(struct mntent *mnt, char *opt);
  3974. Description
  3975. -----------
  3976. This function is a no-op for MS-DOS, but is provided to assist in Unix
  3977. ports.  *Note getmntent::
  3978. Return Value
  3979. ------------
  3980. This function always returns `NULL' to signify an error.
  3981. File: libcref,  Node: htonl,  Next: htons,  Prev: hasmntopt,  Up: Alphabetical List
  3982. `htonl'
  3983. =======
  3984. Syntax
  3985. ------
  3986.      u_long htonl(u_long val);
  3987. Description
  3988. -----------
  3989. This function converts from host formatted longs to network formatted
  3990. longs.  For the i386 and higher processors, this means that the bytes
  3991. are swapped from 1234 order to 4321 order.
  3992. Return Value
  3993. ------------
  3994. The network-order value.
  3995. Example
  3996. -------
  3997.      packet.ipaddr = htonl(ip);
  3998. File: libcref,  Node: htons,  Next: index,  Prev: htonl,  Up: Alphabetical List
  3999. `htons'
  4000. =======
  4001. Syntax
  4002. ------
  4003.      u_short htonl(u_short val);
  4004. Description
  4005. -----------
  4006. This function converts from host formatted shorts to network formatted
  4007. shorts.  For the i386 and higher processors, this means that the bytes
  4008. are swapped from 12 order to 21 order.
  4009. Return Value
  4010. ------------
  4011. The network-order value.
  4012. Example
  4013. -------
  4014.      tcp.port = htons(port);
  4015. File: libcref,  Node: index,  Next: initstate,  Prev: htons,  Up: Alphabetical List
  4016. `index'
  4017. =======
  4018. Syntax
  4019. ------
  4020.      #include <strings.h>
  4021.      
  4022.      char *index(const char *string, int ch);
  4023. Description
  4024. -----------
  4025. Returns a pointer to the first occurrence of CH in STRING.  Note that
  4026. the `NULL' character counts, so if you pass zero as CH you'll get a
  4027. pointer to the end of the string back.
  4028. Return Value
  4029. ------------
  4030. A pointer to the character, or `NULL' if it wasn't found.
  4031. Example
  4032. -------
  4033.      if (index(path, '*'))
  4034.        do_wildcards(path);
  4035. File: libcref,  Node: initstate,  Next: insque,  Prev: index,  Up: Alphabetical List
  4036. `initstate'
  4037. ===========
  4038. Syntax
  4039. ------
  4040.      #include <std.h>
  4041.      
  4042.      char *initstate(unsigned int seed, char *state, int n);
  4043. Description
  4044. -----------
  4045. This function fully initializes the random number generator (*Note
  4046. random::).  For more information on the random number generator,
  4047. consult the source code `libsrc/c/gen/random.c'.
  4048. Return Value
  4049. ------------
  4050. A pointer to the old state.
  4051. File: libcref,  Node: insque,  Next: int86,  Prev: initstate,  Up: Alphabetical List
  4052. `insque'
  4053. ========
  4054. Syntax
  4055. ------
  4056.      void insque(struct vaxque *elem, struct vaxque *prev);
  4057. Description
  4058. -----------
  4059. Given a queue of elements derived from this structure:
  4060.      struct vaxque {
  4061.        struct vaxque *vq_next;
  4062.        struct vaxque *vq_prev;
  4063.      };
  4064. This function inserts a new element ELEM in the queue after the element
  4065. specified (PREV).  This function emulates the VAX `insque' opcode.
  4066. *Note remque::
  4067. Return Value
  4068. ------------
  4069. None.
  4070. File: libcref,  Node: int86,  Next: int86x,  Prev: insque,  Up: Alphabetical List
  4071. `int86'
  4072. =======
  4073. Syntax
  4074. ------
  4075.      #include <dos.h>
  4076.      
  4077.      int int86(int ivec, union REGS *in, union REGS *out);
  4078. Description
  4079. -----------
  4080. This function is just like `int86x' (*Note int86x::) except that
  4081. suitable default values are used for the segment registers.
  4082. Return Value
  4083. ------------
  4084. The returned value of `EAX'.
  4085. Example
  4086. -------
  4087.      union REGS r;
  4088.      r.x.ax = 0x0100;
  4089.      r.h.dl = 'c';
  4090.      int86(0x21, &r, &r);
  4091. File: libcref,  Node: int86x,  Next: intdos,  Prev: int86,  Up: Alphabetical List
  4092. `int86x'
  4093. ========
  4094. Syntax
  4095. ------
  4096.      #include <dos.h>
  4097.      
  4098.      int int86x(int ivec, union REGS *in, union REGS *out, struct SREGS *seg);
  4099. Description
  4100. -----------
  4101. This function simulates a software interrupt.  Note that, unlike the
  4102. `_go32_dpmi_*' functions, requests that go through `int86x' and similar
  4103. functions are normally processed by go32 to make it easier for the
  4104. programmer to use these functions.  For example, if a particular
  4105. routine takes a pointer in `ES:BX', go32 expects you to put a virtual
  4106. pointer in `EBX' and it ignores `ES'.  This is mostly because segments
  4107. aren't used in protected mode the way they are in real mode, so go32
  4108. takes care of the conversion for you - and it knows what your segment
  4109. selectors are anyway.
  4110. When the interrupt is invoked, the CPU registers are copied from IN.
  4111. After the interrupt, the CPU registers are copied to OUT.  In addition,
  4112. the segment registers are loaded from SEG and afterwards stored back
  4113. into SEG.
  4114. *Note int86:: *Note intdos:: *Note bdos::
  4115. Return Value
  4116. ------------
  4117. The value of `EAX' is returned.
  4118. Example
  4119. -------
  4120.      union REGS r;
  4121.      struct SREGS s;
  4122.      r.h.ah = 0x31;
  4123.      r.h.dl = 'c';
  4124.      r.x.si = si_val;
  4125.      s.ds = ds_val;
  4126.      int86x(0x21, &r, &r, &s);
  4127. File: libcref,  Node: intdos,  Next: intdosx,  Prev: int86x,  Up: Alphabetical List
  4128. `intdos'
  4129. ========
  4130. Syntax
  4131. ------
  4132.      #include <dos.h>
  4133.      
  4134.      int intdos(union REGS *in, union REGS *out);
  4135. Description
  4136. -----------
  4137. This function is just like `int86x' (*Note int86x::) except that
  4138. suitable default values are used for the segment registers and the
  4139. interrupt vector is 0x21.
  4140. Return Value
  4141. ------------
  4142. `EAX'
  4143. File: libcref,  Node: intdosx,  Next: _iob,  Prev: intdos,  Up: Alphabetical List
  4144. `intdosx'
  4145. =========
  4146. Syntax
  4147. ------
  4148.      #include <dos.h>
  4149.      
  4150.      int intdosx(union REGS *in, union REGS *out, struct SREGS *s);
  4151. Description
  4152. -----------
  4153. This function is just like `int86x' (*Note int86x::) except that the
  4154. interrupt vector is 0x21.
  4155. Return Value
  4156. ------------
  4157. `EAX'
  4158. File: libcref,  Node: _iob,  Next: isalnum,  Prev: intdosx,  Up: Alphabetical List
  4159. `_iob'
  4160. ======
  4161. Description
  4162. -----------
  4163. This is an internal variable used to keep track of open `FILE*' files.
  4164. File: libcref,  Node: isalnum,  Next: isalpha,  Prev: _iob,  Up: Alphabetical List
  4165. `isalnum'
  4166. =========
  4167. Syntax
  4168. ------
  4169.      #include <ctype.h>
  4170.      
  4171.      int isalnum(int c);
  4172. Description
  4173. -----------
  4174. Tells if C is any letter or digit.
  4175. Return Value
  4176. ------------
  4177. Nonzero if C is a letter or digit, else zero.
  4178. Example
  4179. -------
  4180. File: libcref,  Node: isalpha,  Next: isatty,  Prev: isalnum,  Up: Alphabetical List
  4181. `isalpha'
  4182. =========
  4183. Syntax
  4184. ------
  4185.      #include <ctype.h>
  4186.      
  4187.      int isalpha(int c);
  4188. Description
  4189. -----------
  4190. Tells if C is a letter.
  4191. Return Value
  4192. ------------
  4193. Nonzero if C is a letter, else zero.
  4194. File: libcref,  Node: isatty,  Next: iscntrl,  Prev: isalpha,  Up: Alphabetical List
  4195. `isatty'
  4196. ========
  4197. Syntax
  4198. ------
  4199.      #include <osfcn.h>
  4200.      
  4201.      int isatty(int fd);
  4202. Description
  4203. -----------
  4204. Tells if the file descriptor refers to a physical device or a disk file.
  4205. Return Value
  4206. ------------
  4207. Nonzero if FD is a device, zero if it is a disk file.
  4208. Example
  4209. -------
  4210.      if (isatty(1))
  4211.        fflush(stdout);
  4212. File: libcref,  Node: iscntrl,  Next: isdigit,  Prev: isatty,  Up: Alphabetical List
  4213. `iscntrl'
  4214. =========
  4215. Syntax
  4216. ------
  4217.      #include <ctype.h>
  4218.      
  4219.      int iscntrl(int c);
  4220. Description
  4221. -----------
  4222. Tells if C is a control character.
  4223. Return Value
  4224. ------------
  4225. Nonzero if C is a control character, else zero.
  4226. File: libcref,  Node: isdigit,  Next: isgraph,  Prev: iscntrl,  Up: Alphabetical List
  4227. `isdigit'
  4228. =========
  4229. Syntax
  4230. ------
  4231.      #include <ctype.h>
  4232.      
  4233.      int isdigit(int c);
  4234. Description
  4235. -----------
  4236. Tells if C is a digit.
  4237. Return Value
  4238. ------------
  4239. Nonzero if C is a digit, else zero.
  4240. File: libcref,  Node: isgraph,  Next: islower,  Prev: isdigit,  Up: Alphabetical List
  4241. `isgraph'
  4242. =========
  4243. Syntax
  4244. ------
  4245.      #include <ctype.h>
  4246.      
  4247.      int isgraph(int c);
  4248. Description
  4249. -----------
  4250. Tells if C is a visible printing character.  Space is not included.
  4251. Return Value
  4252. ------------
  4253. Nonzero if C is a visible printing character, else zero.
  4254. File: libcref,  Node: islower,  Next: isprint,  Prev: isgraph,  Up: Alphabetical List
  4255. `islower'
  4256. =========
  4257. Syntax
  4258. ------
  4259.      #include <ctype.h>
  4260.      
  4261.      int islower(int c);
  4262. Description
  4263. -----------
  4264. Tells if C is lower case or not.
  4265. Return Value
  4266. ------------
  4267. Nonzero if C is lower case, else zero.
  4268. File: libcref,  Node: isprint,  Next: ispunct,  Prev: islower,  Up: Alphabetical List
  4269. `isprint'
  4270. =========
  4271. Syntax
  4272. ------
  4273.      #include <ctype.h>
  4274.      
  4275.      int isprint(int c);
  4276. Description
  4277. -----------
  4278. Tells if C is a printing character, which includes the space character.
  4279. Return Value
  4280. ------------
  4281. Nonzero if C is a printing character, else zero.
  4282. File: libcref,  Node: ispunct,  Next: isspace,  Prev: isprint,  Up: Alphabetical List
  4283. `ispunct'
  4284. =========
  4285. Syntax
  4286. ------
  4287.      #include <ctype.h>
  4288.      
  4289.      int ispunct(int c);
  4290. Description
  4291. -----------
  4292. Tells if C is any printing character except space and those indicated
  4293. by `isalnum'.
  4294. Return Value
  4295. ------------
  4296. Nonzero if C is punctuation, else zero.
  4297. File: libcref,  Node: isspace,  Next: isupper,  Prev: ispunct,  Up: Alphabetical List
  4298. `isspace'
  4299. =========
  4300. Syntax
  4301. ------
  4302.      #include <ctype.h>
  4303.      
  4304.      int isspace(int c);
  4305. Description
  4306. -----------
  4307. Tells if C is whitespace, that is, carriage return, newline, form feed,
  4308. tab, vertical tab, or space.
  4309. Return Value
  4310. ------------
  4311. Nonzero if C is whitespace, else zero.
  4312. File: libcref,  Node: isupper,  Next: isxdigit,  Prev: isspace,  Up: Alphabetical List
  4313. `isupper'
  4314. =========
  4315. Syntax
  4316. ------
  4317.      #include <ctype.h>
  4318.      
  4319.      int isupper(int c);
  4320. Description
  4321. -----------
  4322. Tells if C is an upper case character or not.
  4323. Return Value
  4324. ------------
  4325. Nonzero if C is upper case, else zero.
  4326. File: libcref,  Node: isxdigit,  Next: kbhit,  Prev: isupper,  Up: Alphabetical List
  4327. `isxdigit'
  4328. ==========
  4329. Syntax
  4330. ------
  4331.      #include <ctype.h>
  4332.      
  4333.      int isxdigit(int c);
  4334. Description
  4335. -----------
  4336. Tells if C is a valid hexidecimal digit or not.  This includes
  4337. `[0-9a-fA-f]'.
  4338. Return Value
  4339. ------------
  4340. Nonzero if C is a hex digit, else zero.
  4341. File: libcref,  Node: kbhit,  Next: kill,  Prev: isxdigit,  Up: Alphabetical List
  4342. `kbhit'
  4343. =======
  4344. Syntax
  4345. ------
  4346.      #include <pc.h>
  4347.      
  4348.      int kbhit(void);
  4349. Description
  4350. -----------
  4351. If the user has hit a key, this function will detect it.  This function
  4352. is very fast when there is no key waiting, so it may be used inside
  4353. loops as needed.
  4354. Return Value
  4355. ------------
  4356. Nonzero if a key has been hit, else zero.
  4357. Example
  4358. -------
  4359.      while (!kbhit())
  4360.        do_stuff();
  4361. File: libcref,  Node: kill,  Next: labs,  Prev: kbhit,  Up: Alphabetical List
  4362. `kill'
  4363. ======
  4364. Description
  4365. -----------
  4366. This function does nothing.  It exists to assist in porting Unix
  4367. programs.
  4368. File: libcref,  Node: labs,  Next: ldexp,  Prev: kill,  Up: Alphabetical List
  4369. `labs'
  4370. ======
  4371. Syntax
  4372. ------
  4373.      #include <stdlib.h>
  4374.      
  4375.      long labs(long x);
  4376. Description
  4377. -----------
  4378. This function takes the absolute value of X.  *Note abs::
  4379. Return Value
  4380. ------------
  4381. File: libcref,  Node: ldexp,  Next: ldiv,  Prev: labs,  Up: Alphabetical List
  4382. `ldexp'
  4383. =======
  4384. Syntax
  4385. ------
  4386.      #include <math.h>
  4387.      
  4388.      double ldexp(double val, int exp);
  4389. Return Value
  4390. ------------
  4391. This function returns VAL * 2 ** EXP.
  4392. Example
  4393. -------
  4394.      ldexp(3.5,4) == 3.5 * 16 == 56.0
  4395. File: libcref,  Node: ldiv,  Next: link,  Prev: ldexp,  Up: Alphabetical List
  4396. `ldiv'
  4397. ======
  4398. Syntax
  4399. ------
  4400.      #include <stdlib.h>
  4401.      
  4402.      ldiv_t ldiv(long numerator, long denomonator);
  4403. Description
  4404. -----------
  4405. Returns the quotient and remainder of the division NUMBERATOR divided
  4406. by DENOMONATOR.  The return type is as follows:
  4407.      typedef struct {
  4408.        long quot;
  4409.        long rem;
  4410.      } ldiv_t;
  4411. Return Value
  4412. ------------
  4413. The results of the division are returned.
  4414. Example
  4415. -------
  4416.      ldiv_t l = div(42, 3);
  4417.      printf("42 = %ld x 3 + %ld\n", l.quot, l.rem);
  4418. File: libcref,  Node: link,  Next: localtime,  Prev: ldiv,  Up: Alphabetical List
  4419. `link'
  4420. ======
  4421. Syntax
  4422. ------
  4423.      #include <osfcn.h>
  4424.      
  4425.      int link(const char *exists, const char *new);
  4426. Description
  4427. -----------
  4428. Because of limitations of MS-DOS, this function doesn't really link two
  4429. files together.  However, it simulates a real `link' by copying the
  4430. file at EXISTS to NEW.
  4431. Return Value
  4432. ------------
  4433. Zero on success, nonzero on failure.
  4434. Example
  4435. -------
  4436.      link("foo.c", "foo.bak");
  4437. File: libcref,  Node: localtime,  Next: lock,  Prev: link,  Up: Alphabetical List
  4438. `localtime'
  4439. ===========
  4440. Syntax
  4441. ------
  4442.      #include <time.h>
  4443.      
  4444.      struct tm *localtime(const time_t *tod);
  4445. Description
  4446. -----------
  4447. Converts the time represented by TOD into a structure, correcting for
  4448. the local timezone.  *Note gmtime::
  4449. Return Value
  4450. ------------
  4451. A pointer to a static structure which is overridden with each call.
  4452. File: libcref,  Node: lock,  Next: longjmp,  Prev: localtime,  Up: Alphabetical List
  4453. `lock'
  4454. ======
  4455. Syntax
  4456. ------
  4457.      #include <io.h>
  4458.      
  4459.      int lock(int fd, long offset, long length);
  4460. Description
  4461. -----------
  4462. Locks a region in file FD using MS-DOS file sharing interface.  The
  4463. region of LENGTH bytes, starting from OFFSET, will become entirely
  4464. inaccessible to other processes. If multiple locks are used on a single
  4465. file they must be non-overlapping. The lock must be removed before the
  4466. file is closed.
  4467. This function will fail unless SHARE, or a network software providing
  4468. similar interface, is installed. This function is compatible with
  4469. Borland C++ function of the same name.
  4470. *Note unlock::.
  4471. Return Value
  4472. ------------
  4473. Zero if successful, nonzero if not.
  4474. File: libcref,  Node: longjmp,  Next: longjmperror,  Prev: lock,  Up: Alphabetical List
  4475. `longjmp'
  4476. =========
  4477. Syntax
  4478. ------
  4479.      #include <setjmp.h>
  4480.      
  4481.      void longjmp(jmp_buf env, int val);
  4482. Description
  4483. -----------
  4484. This function reverts back to a CPU state that was stored in ENV by
  4485. `setjmp' (*Note setjmp::).  The state includes all CPU registers, so
  4486. any variable in a register when `setjmp' was called will be preserved,
  4487. and all else will be indeterminate.
  4488. The value passed as VAL will be the return value of `setjmp' when it
  4489. resumes processing there.  If VAL is zero, the return value will be one.
  4490. Return Value
  4491. ------------
  4492. This function does not return.
  4493. Example
  4494. -------
  4495.      jmp_buf j;
  4496.      if (setjmp(j))
  4497.        return;
  4498.      do_something();
  4499.      longjmp(j);
  4500. File: libcref,  Node: longjmperror,  Next: lseek,  Prev: longjmp,  Up: Alphabetical List
  4501. `longjmperror'
  4502. ==============
  4503. Syntax
  4504. ------
  4505.      void longjmperr(void);
  4506. Description
  4507. -----------
  4508. This function is internal and is used by setjmp and longjmp when they
  4509. detect an invalid longjmp request.
  4510. Return Value
  4511. ------------
  4512. None.
  4513. File: libcref,  Node: lseek,  Next: __main,  Prev: longjmperror,  Up: Alphabetical List
  4514. `lseek'
  4515. =======
  4516. Syntax
  4517. ------
  4518.      #include <osfcn.h>
  4519.      
  4520.      long lseek(nit fd, long offset, int whence);
  4521. Description
  4522. -----------
  4523. This function moves the file pointer for FD according to MODE:
  4524. `SEEK_SET'
  4525.      The file pointer is moved to the offset specified.
  4526. `SEEK_CUR'
  4527.      The file pointer is moved relative to its current position.
  4528. `SEEK_END'
  4529.      The file pointer is moved to a position OFFSET bytes from the end
  4530.      of the file.  The offset is usually nonpositive in this case.
  4531. Return Value
  4532. ------------
  4533. The new offset is returned.
  4534. Example
  4535. -------
  4536.      lseek(fd, 12, SEEK_CUR); /* skip 12 bytes */
  4537. File: libcref,  Node: __main,  Next: malloc,  Prev: lseek,  Up: Alphabetical List
  4538. `__main'
  4539. ========
  4540. Description
  4541. -----------
  4542. This function is used internally to initialize the application, and
  4543. should not be directly called by the programmer.
  4544. File: libcref,  Node: malloc,  Next: memccpy,  Prev: __main,  Up: Alphabetical List
  4545. `malloc'
  4546. ========
  4547. Syntax
  4548. ------
  4549.      #include <stdlib.h>
  4550.      
  4551.      void *malloc(size_t size);
  4552. Description
  4553. -----------
  4554. This function allocates a chunk of memory from the heap large enough to
  4555. hold any object that is SIZE bytes in length.  This memory must be
  4556. returned to the heap with `free' (*Note free::).
  4557. Return Value
  4558. ------------
  4559. A pointer to the allocated memory, or `NULL' if there isn't enough free
  4560. memory to satisfy the request.
  4561. Example
  4562. -------
  4563.      char *c = (char *)malloc(100);
  4564. File: libcref,  Node: memccpy,  Next: memchr,  Prev: malloc,  Up: Alphabetical List
  4565. `memccpy'
  4566. =========
  4567. Syntax
  4568. ------
  4569.      #include <string.h>
  4570.      
  4571.      void *memccpy(void *dest, const void *source, int ch, size_t num);
  4572. Description
  4573. -----------
  4574. This function copies at most NUM bytes from SOURCE to DEST, stopping if
  4575. the character CH is copied.
  4576. Return Value
  4577. ------------
  4578. A pointer to the character after CH, if it was found, else `NULL'.
  4579. Example
  4580. -------
  4581.      char buf[20];
  4582.      memccpy(buf, "hello!", 'l', 20);
  4583. File: libcref,  Node: memchr,  Next: memcmp,  Prev: memccpy,  Up: Alphabetical List
  4584. `memchr'
  4585. ========
  4586. Syntax
  4587. ------
  4588.      void *memchr(const void *string, int ch, size_t num);
  4589. Description
  4590. -----------
  4591. This function searches NUM bytes starting at STRING, looking for the
  4592. first occurence of CH.
  4593. Return Value
  4594. ------------
  4595. A pointer to the first match, or `NULL' if it wasn't found.
  4596. Example
  4597. -------
  4598.      if (memchr(path, '/', strlen(path))
  4599.        do_slash();
  4600. File: libcref,  Node: memcmp,  Next: _memcpy,  Prev: memchr,  Up: Alphabetical List
  4601. `memcmp'
  4602. ========
  4603. Syntax
  4604. ------
  4605.      #include <string.h>
  4606.      
  4607.      int memcmp(const void *s1, const void *s2, size_t num);
  4608. Description
  4609. -----------
  4610. This function compares two regions of memory, at S1 and S2, for NUM
  4611. bytes.
  4612. Return Value
  4613. ------------
  4614.      s1 == s2
  4615. positive
  4616.      s1 > s2
  4617. negative
  4618.      s1 < s2
  4619. File: libcref,  Node: _memcpy,  Next: memcpy,  Prev: memcmp,  Up: Alphabetical List
  4620. `_memcpy'
  4621. =========
  4622. Syntax
  4623. ------
  4624.      #include <string.h>
  4625.      
  4626.      void *_memcpy(void *dest, const void *src, int num);
  4627. Description
  4628. -----------
  4629. This function is just like `memcpy' (*Note memcpy::), but it doesn't
  4630. use the i386 `movs' opcode, in case the source and destination are on
  4631. memory pages that can't reside in the system at the same time.  This is
  4632. used primarily for screen to screen copies of the graphics screen, in
  4633. case the two regions are in different graphics windows.
  4634. Return Value
  4635. ------------
  4636. File: libcref,  Node: memcpy,  Next: memmove,  Prev: _memcpy,  Up: Alphabetical List
  4637. `memcpy'
  4638. ========
  4639. Syntax
  4640. ------
  4641.      #include <string.h>
  4642.      
  4643.      void *memcpy(void *dest, const void *src, int num);
  4644. Description
  4645. -----------
  4646. This function copies NUM bytes from SOURCE to DEST.
  4647. Return Value
  4648. ------------
  4649. Example
  4650. -------
  4651.      memcpy(buffer, temp_buffer, BUF_MAX);
  4652. File: libcref,  Node: memmove,  Next: memset,  Prev: memcpy,  Up: Alphabetical List
  4653. `memmove'
  4654. =========
  4655. Syntax
  4656. ------
  4657.      #include <string.h>
  4658.      
  4659.      void *memmove(void *dest, const void *source, int num);
  4660. Description
  4661. -----------
  4662. This function copies NUM bytes from SOURCE to DEST.  The copy is done
  4663. in such a way that if the two regions overlap, the source is always
  4664. read before that byte is changed by writing to the destination.
  4665. Return Value
  4666. ------------
  4667. Example
  4668. -------
  4669.      memmove(buf+1, buf, 99);
  4670.      memmove(buf, buf+1, 99);
  4671. File: libcref,  Node: memset,  Next: mkdir,  Prev: memmove,  Up: Alphabetical List
  4672. `memset'
  4673. ========
  4674. Syntax
  4675. ------
  4676.      #include <string.h>
  4677.      
  4678.      void *memset(void *buffer, int ch, size_t num);
  4679. Description
  4680. -----------
  4681. This function stores NUM copies of CH, starting at BUFFER.  This is
  4682. often used to initialize objects to a known value.
  4683. Return Value
  4684. ------------
  4685. BUFFER
  4686. Example
  4687. -------
  4688.      struct tm t;
  4689.      memset(&t, 0, sizeof(t));
  4690. File: libcref,  Node: mkdir,  Next: mkfifo,  Prev: memset,  Up: Alphabetical List
  4691. `mkdir'
  4692. =======
  4693. Syntax
  4694. ------
  4695.      #include <osfcn.h>
  4696.      
  4697.      int mkdir(const char *path, int mode);
  4698. Description
  4699. -----------
  4700. This function creates a subdirectory.  The MODE field is ignored under
  4701. MS-DOS.
  4702. Return Value
  4703. ------------
  4704. Zero if the subdirectory was created, nonzero on failure.
  4705. Example
  4706. -------
  4707.      mkdir("/usr/tmp");
  4708. File: libcref,  Node: mkfifo,  Next: mknod,  Prev: mkdir,  Up: Alphabetical List
  4709. `mkfifo'
  4710. ========
  4711. Description
  4712. -----------
  4713. This function is provided only to assist in porting from Unix.  It
  4714. always returns an error condition.
  4715. File: libcref,  Node: mknod,  Next: mkstemp,  Prev: mkfifo,  Up: Alphabetical List
  4716. `mknod'
  4717. =======
  4718. Description
  4719. -----------
  4720. This function is provided only to assist in porting from Unix.  It
  4721. always returns an error condition.
  4722. File: libcref,  Node: mkstemp,  Next: mktemp,  Prev: mknod,  Up: Alphabetical List
  4723. `mkstemp'
  4724. =========
  4725. Syntax
  4726. ------
  4727.      #include <stdio.h>
  4728.      
  4729.      int mkstemp(char *template);
  4730. Description
  4731. -----------
  4732. TEMPLATE is a file specification that ends with six trailing `X'
  4733. characters.  This function replaces the `XXXXXX' with a set of
  4734. characters such that the resulting file name names a nonexisting file.
  4735. It then creates and opens the file.
  4736. Note that since MS-DOS is limited to eight characters for the file name,
  4737. and since none of the `X''s get replaced by a dot, you can only have
  4738. two additional characters before the `X''s.
  4739. Return Value
  4740. ------------
  4741. The open file descriptor.
  4742. Example
  4743. -------
  4744.      int fd = mkstemp("/tmp/ccXXXXXX");
  4745. File: libcref,  Node: mktemp,  Next: mktime,  Prev: mkstemp,  Up: Alphabetical List
  4746. `mktemp'
  4747. ========
  4748. Syntax
  4749. ------
  4750.      #include <stdio.h>
  4751.      
  4752.      char *mktemp(char *template);
  4753. Description
  4754. -----------
  4755. TEMPLATE is a file specification that ends with six trailing `X'
  4756. characters.  This function replaces the `XXXXXX' with a set of
  4757. characters such that the resulting file name names a nonexisting file.
  4758. Note that since MS-DOS is limited to eight characters for the file name,
  4759. and since none of the `X''s get replaced by a dot, you can only have
  4760. two additional characters before the `X''s.
  4761. Return Value
  4762. ------------
  4763. The resulting filename.
  4764. Example
  4765. -------
  4766.      char template[] = "/tmp/ccXXXXXX";
  4767.      mktemp(template);
  4768.      FILE *q = fopen(template, "w");
  4769. File: libcref,  Node: mktime,  Next: modf,  Prev: mktemp,  Up: Alphabetical List
  4770. `mktime'
  4771. ========
  4772. Syntax
  4773. ------
  4774.      #include <time.h>
  4775.      
  4776.      time_t mktime(struct tm *tptr);
  4777. Description
  4778. -----------
  4779. This function converts a time structure into the number of seconds since
  4780. 00:00:00 GMT 1/1/1970.  It also attempts to normalize the fields of
  4781. TPTR.
  4782. Return Value
  4783. ------------
  4784. The resulting time, or -1 if the time in TPTR cannot be described in
  4785. that format.
  4786. File: libcref,  Node: modf,  Next: morecore,  Prev: mktime,  Up: Alphabetical List
  4787. `modf'
  4788. ======
  4789. Syntax
  4790. ------
  4791.      #include <math.h>
  4792.      
  4793.      double modf(double x, double *pint);
  4794. Description
  4795. -----------
  4796. This function decomposes X into it's integer part (*PINT) and it's
  4797. fractional part (return value) such that the two have the same sign and
  4798. add up to X.
  4799. Return Value
  4800. ------------
  4801. The fractional part.
  4802. Example
  4803. -------
  4804.      double f, i;
  4805.      f = modf(2.3, &i);
  4806.      /* f == 0.3, i == 2.0 */
  4807. File: libcref,  Node: morecore,  Next: movedata,  Prev: modf,  Up: Alphabetical List
  4808. `morecore'
  4809. ==========
  4810. Description
  4811. -----------
  4812. This is an internal function used by `malloc' (*Note malloc::).
  4813. File: libcref,  Node: movedata,  Next: nlist,  Prev: morecore,  Up: Alphabetical List
  4814. `movedata'
  4815. ==========
  4816. Syntax
  4817. ------
  4818.      #include <go32.h>
  4819.      
  4820.      void movedata(unsigned source_selector, unsigned source_offset,
  4821.                    unsigned dest_selector, unsigned dest_offset,
  4822.                    size_t length);
  4823. Description
  4824. -----------
  4825. This function allows the caller to directly transfer information between
  4826. conventional and linear memory, and among each as well.  The selectors
  4827. passed are *not* segment values like in DOS.  They are protected mode
  4828. selectors that can be obtained by the `_go32_my_ds' and
  4829. `_go32_conventional_mem_selector' functions (*Note _go32_my_ds:: *Note
  4830. _go32_conventional_mem_selector::).  The offsets are linear offsets.
  4831. If the selector is for the program's data area, this offset corresponds
  4832. to the address of a buffer (like `(int)&something').  If the selector
  4833. is for the conventional memory area, the offset is the physical address
  4834. of the memory, which can be computed from a traditional segment/offset
  4835. pair as `segment'*16+`offset'.  For example, the color text screen
  4836. buffer is at offset 0xb8000.
  4837. Return Value
  4838. ------------
  4839. None.
  4840. Example
  4841. -------
  4842.      short blank_row_buf[ScreenCols()];
  4843.      /* scroll screen */
  4844.      movedata(_go32_conventional_mem_selector(), 0xb8000 + ScreenCols()*2,
  4845.               _go32_conventional_mem_selector(), 0xb8000,
  4846.               ScreenCols() * (ScreenRows()-1) * 2);
  4847.      /* fill last row */
  4848.      movedata(_go32_my_ds, (int)blank_row_buf,
  4849.               _go32_conventional_mem_selector(),
  4850.                  0xb8000 + ScreenCols()*(ScreenRows()-1)*2,
  4851.                ScreenCols() * 2);
  4852. File: libcref,  Node: nlist,  Next: ntohl,  Prev: movedata,  Up: Alphabetical List
  4853. `nlist'
  4854. =======
  4855. Description
  4856. -----------
  4857. This function reads synbol addresses out of a.out style executables.  It
  4858. doesn't work and djgpp uses COFF style, so don't use it.
  4859. File: libcref,  Node: ntohl,  Next: ntohs,  Prev: nlist,  Up: Alphabetical List
  4860. `ntohl'
  4861. =======
  4862. Syntax
  4863. ------
  4864.      u_long ntohl(u_long val);
  4865. Description
  4866. -----------
  4867. This function converts from network formatted longs to host formatted
  4868. longs.  For the i386 and higher processors, this means that the bytes
  4869. are swapped from 1234 order to 4321 order.
  4870. Return Value
  4871. ------------
  4872. The host-order value.
  4873. Example
  4874. -------
  4875.      ip = htonl(packet.ipaddr);
  4876. File: libcref,  Node: ntohs,  Next: on_exit,  Prev: ntohl,  Up: Alphabetical List
  4877. `ntohs'
  4878. =======
  4879. Syntax
  4880. ------
  4881.      u_short ntohl(u_short val);
  4882. Description
  4883. -----------
  4884. This function converts from network formatted shorts to host formatted
  4885. shorts.  For the i386 and higher processors, this means that the bytes
  4886. are swapped from 12 order to 21 order.
  4887. Return Value
  4888. ------------
  4889. The host-order value.
  4890. Example
  4891. -------
  4892.      port = htons(tcp.port);
  4893. File: libcref,  Node: on_exit,  Next: open,  Prev: ntohs,  Up: Alphabetical List
  4894. `on_exit'
  4895. =========
  4896. Syntax
  4897. ------
  4898.      #include <atexit.h>
  4899.      
  4900.      int on_exit(void (*func)(int), int value);
  4901. Description
  4902. -----------
  4903. This function registers a function to be called when the program is
  4904. exiting.  The function is passed the VALUE registered.  *Note atexit::
  4905. Return Value
  4906. ------------
  4907. Zero on success, nonzero on failure.
  4908. Example
  4909. -------
  4910.      void my_exiter(int arg)
  4911.      {
  4912.        cleanup_me(arg, 1);
  4913.      }
  4914.      
  4915.      on_exit(my_exiter, 4);
  4916. File: libcref,  Node: open,  Next: opendir,  Prev: on_exit,  Up: Alphabetical List
  4917. `open'
  4918. ======
  4919. Syntax
  4920. ------
  4921.      #include <fcntl.h>    /* for O_* */
  4922.      #include <sys/stat.h> /* for S_* */
  4923.      #include <osfcn.h>
  4924.      
  4925.      int open(const char *file, int mode, int permissions);
  4926. Description
  4927. -----------
  4928. This function opens the named FILE in the given MODE, which is any
  4929. combination of the following:
  4930. `O_RDONLY'
  4931.      The file is opened for reading.
  4932. `O_WRONLY'
  4933.      The file is opened for writing.
  4934. `O_RDWR'
  4935.      The file is opened for both reading and writing.
  4936. `O_CREAT'
  4937.      If the file does not exist, it is created. *Note creat::
  4938. `O_TRUNC'
  4939.      If the file does exist, it is truncated to zero bytes.
  4940. `O_EXCL'
  4941.      If the file exists, and `O_CREAT' is also specified, the `open'
  4942.      call will fail.
  4943. `O_APPEND'
  4944.      The file pointer is positioned at the end of the file before each
  4945.      write.
  4946. `O_TEXT'
  4947.      The file is opened in text mode, meaning that Ctrl-M characters are
  4948.      stripped on reading and added on writing as needed.  The default
  4949.      mode is specified by the `_fmode' variable *Note _fmode::.
  4950. `O_BINARY'
  4951.      The file is opened in binary mode.
  4952. If the file is created by this call, it will be given the read/write
  4953. permissions specified by PERMISSIONS, which may be any combination of
  4954. these values:
  4955. `S_IREAD'
  4956.      The file is readable.  This is always true for MS-DOS
  4957. `S_IWRITE'
  4958.      The file is writable.
  4959. Return Value
  4960. ------------
  4961. If successful, the file descriptor is returned.  On error, a negative
  4962. number is returned and `errno' is set to indicate the error.
  4963. Example
  4964. -------
  4965.      int q = open("/tmp/foo.dat", O_RDONLY|O_BINARY);
  4966. File: libcref,  Node: opendir,  Next: optarg,  Prev: open,  Up: Alphabetical List
  4967. `opendir'
  4968. =========
  4969. Syntax
  4970. ------
  4971.      #include <dirent.h>
  4972.      
  4973.      DIR *opendir(char *name);
  4974. Description
  4975. -----------
  4976. This function "opens" a directory so that you can read the list of file
  4977. names in it.  The pointer returned must be passed to `closedir' when
  4978. you are done with it.  *Note readdir::.
  4979. Return Value
  4980. ------------
  4981. The open directory structure, or `NULL' on error.
  4982. Example
  4983. -------
  4984.      DIR *d = opendir(".");
  4985.      closedir(d);
  4986. File: libcref,  Node: optarg,  Next: opterr,  Prev: opendir,  Up: Alphabetical List
  4987. `optarg'
  4988. ========
  4989. Description
  4990. -----------
  4991. *Note getopt::
  4992. File: libcref,  Node: opterr,  Next: optind,  Prev: optarg,  Up: Alphabetical List
  4993. `opterr'
  4994. ========
  4995. Description
  4996. -----------
  4997. *Note getopt::
  4998. File: libcref,  Node: optind,  Next: optopt,  Prev: opterr,  Up: Alphabetical List
  4999. `optind'
  5000. ========
  5001. Description
  5002. -----------
  5003. *Note getopt::
  5004. File: libcref,  Node: optopt,  Next: pathconf,  Prev: optind,  Up: Alphabetical List
  5005. `optopt'
  5006. ========
  5007. Description
  5008. -----------
  5009. *Note getopt::
  5010. File: libcref,  Node: pathconf,  Next: pclose,  Prev: optopt,  Up: Alphabetical List
  5011. `pathconf'
  5012. ==========
  5013. Syntax
  5014. ------
  5015.      #include <unistd.h>
  5016.      
  5017.      long pathconf(const char *filename, int name);
  5018. Description
  5019. -----------
  5020. This function returns various system-dependent configuration values.
  5021. The NAME is one of the following:
  5022. `_PC_LINK_MAX'
  5023.      The maximum number of directory entries that can refer to a single
  5024.      real file.
  5025. `_PC_MAX_CANON'
  5026.      The maximum number of bytes in an editable input line.
  5027. `_PC_MAX_INPUT'
  5028.      The maximum number of bytes in a non-editable input line.
  5029. `_PC_NAME_MAX'
  5030.      The maximum length of an individual file name.
  5031. `_PC_PATH_MAX'
  5032.      The maximum length of a complete path name.
  5033. `_PC_PIPE_BUF'
  5034.      The size of a pipe's internal buffer.
  5035. Return Value
  5036. ------------
  5037. The selected configuration value is returned.
  5038. Example
  5039. -------
  5040.      char *buf = malloc(pathconf("c:/", _PC_MAX_PATH)+1);
  5041. File: libcref,  Node: pclose,  Next: perror,  Prev: pathconf,  Up: Alphabetical List
  5042. `pclose'
  5043. ========
  5044. Syntax
  5045. ------
  5046.      #include <stdio.h>
  5047.      
  5048.      int pclose(FILE *pipe);
  5049. Description
  5050. -----------
  5051. This function closes a pipe opened with `popen' (*Note popen::).  Note
  5052. that since MS-DOS is not multitasking, this function will actually run
  5053. the program specified in `popen' if the pipe was opened for writing.
  5054. Return Value
  5055. ------------
  5056. Zero on success, nonzero on failure.
  5057. Example
  5058. -------
  5059.      FILE *f = popen("sort", "w");
  5060.      write_to_pipe(f);
  5061.      pclose(f);
  5062. File: libcref,  Node: perror,  Next: pipe,  Prev: pclose,  Up: Alphabetical List
  5063. `perror'
  5064. ========
  5065. Syntax
  5066. ------
  5067.      #include <stdio.h>
  5068.      
  5069.      void perror(const char *string);
  5070. Description
  5071. -----------
  5072. This function formats an error message and prints it to `stderr'.  The
  5073. message is the string, a colon, and a message suitable for the error
  5074. condition indicated by `errno'.
  5075. Return Value
  5076. ------------
  5077. None.
  5078. Example
  5079. -------
  5080.      int x = open("foo", O_RDONLY);
  5081.      if (x < 0)
  5082.      {
  5083.        perror("foo");
  5084.        exit(1);
  5085.      }
  5086. File: libcref,  Node: pipe,  Next: popen,  Prev: perror,  Up: Alphabetical List
  5087. `pipe'
  5088. ======
  5089. Description
  5090. -----------
  5091. This function is provided only to assist in porting from Unix.  It
  5092. always returns an error condition.
  5093. File: libcref,  Node: popen,  Next: printf,  Prev: pipe,  Up: Alphabetical List
  5094. `popen'
  5095. =======
  5096. Syntax
  5097. ------
  5098.      #include <stdio.h>
  5099.      
  5100.      FILE *popen(const char *program, const char *mode);
  5101. Description
  5102. -----------
  5103. This function executes the named `program' and attaches either it's
  5104. input stream or it's output stream to the returned file.  While the file
  5105. is open, the calling program can write to the program (if the program
  5106. was open for writing) or read the program's output (if the program was
  5107. opened for reading).  When the program is done, or if you have no more
  5108. input for it, pass the file pointer to `pclose' (*Note pclose::), which
  5109. terminates the program.
  5110. Since MS-DOS does not support multitasking, this function actually runs
  5111. the entire program when the program is opened for reading, and stores
  5112. the output in a temporary file.  `pclose' then removes that file.
  5113. Similarly, when you open a program for writing, a temp file holds the
  5114. data and `pclose' runs the entire program.
  5115. The MODE is the same as for `fopen' (*Note fopen::).
  5116. Return Value
  5117. ------------
  5118. An open file which can be used to read the program's output or write to
  5119. the program's input.
  5120. Example
  5121. -------
  5122.      FILE *p = popen("dir", "r");
  5123.      read_program(p);
  5124.      pclose(p);
  5125. File: libcref,  Node: printf,  Next: putc,  Prev: popen,  Up: Alphabetical List
  5126. `printf'
  5127. ========
  5128. Syntax
  5129. ------
  5130.      #include <stdio.h>
  5131.      
  5132.      int printf(const char *format, ...);
  5133. Description
  5134. -----------
  5135. Sends formatted output from the arguments (...) to `stdout'.
  5136. The format string contains regular characters to print, as well as
  5137. conversion specifiers, which begin with a percent symbol.  Each
  5138. conversion speficier contains the following fields:
  5139.    *  an optional flag, which may alter the conversion:
  5140.     `-'
  5141.           left-justify the field.
  5142.     `+'
  5143.           Force a `+' sign on positive numbers.
  5144.     `space'
  5145.           To leave a blank space where a plus or minus sign would have
  5146.           been.
  5147.     `#'
  5148.           Alternate conversion - prefix octal numbers with `0',
  5149.           hexadecimal numbers with `0x' or `0X', or force a trailing
  5150.           decimal point if a floating point conversion would have
  5151.           omitted it.
  5152.     `0'
  5153.           To pad numbers with leading zeros.
  5154.    *  A field width specifier, which specifies the minimum width of the
  5155.      field.  This may also be an asterisk (`*'), which means that the
  5156.      actual width will be obtained from the next argument.  If the
  5157.      argument is negative, it supplies a `-' flag and a positive width.
  5158.    *  An optional decimal point and a precision.  This may also be an
  5159.      asterisk, but a negative argument for it indicates a precision of
  5160.      zero.  The precision specifies the minimum number of digits to
  5161.      print for an integer, the number of fraction digits for a floating
  5162.      point number (max for `g' or `G', actual for others), or the
  5163.      maximum number of characters for a string.
  5164.    *  An optional conversion qualifier, which may be `h' to specify
  5165.      `short' or `l' or `L' to specify `long'.
  5166.    *  The conversion type specifier:
  5167.     `c'
  5168.           A single character
  5169.     `d'
  5170.           A signed integer
  5171.     `D'
  5172.           A signed long integer
  5173.     `e'
  5174.     `E'
  5175.           A floating point number (double or long double).  The
  5176.           exponent case matches the specifier case.  The representation
  5177.           always has an exponent.
  5178.     `f'
  5179.           A floating point number (double or long double).  The
  5180.           representation never has an exponent.
  5181.     `g'
  5182.     `G'
  5183.           A floating point number (double or long double).  The
  5184.           exponent case matches the specifier case.  The representation
  5185.           has an exponent if it needs one.
  5186.     `i'
  5187.           A signed integer.
  5188.     `n'
  5189.           The next argument is a pointer to an integer, and the number
  5190.           of characters generated so far is stored in that integer.
  5191.     `o'
  5192.           A unsigned integer, printed in base 8 instead of base 10.
  5193.     `p'
  5194.           A pointer.  This is printed with an `x' specifier.
  5195.     `s'
  5196.           A `NULL'-terminated string.
  5197.     `u'
  5198.           An unsigned integer.
  5199.     `U'
  5200.           An unsigned long integer.
  5201.     `x'
  5202.     `X'
  5203.           An unsigned integer, printed in base 16 instead of base 10.
  5204.           The case of the letters used matches the specifier case.
  5205.     `%'
  5206.           A single percent symbol is printed.
  5207. Return Value
  5208. ------------
  5209. The number of characters written.
  5210. Example
  5211. -------
  5212.      printf("%-3d %10.2f%% Percent of %s\n", index, per[index], name[index]);
  5213. File: libcref,  Node: putc,  Next: putchar,  Prev: printf,  Up: Alphabetical List
  5214. `putc'
  5215. ======
  5216. Syntax
  5217. ------
  5218.      #include <stdio.h>
  5219.      
  5220.      int putc(int c, FILE *file);
  5221. Description
  5222. -----------
  5223. This function writes one character to the given FILE.
  5224. Return Value
  5225. ------------
  5226. The character written.
  5227. Example
  5228. -------
  5229.      while ((c=getc(stdin)) != EOF)
  5230.        putc(c, stdout);
  5231. File: libcref,  Node: putchar,  Next: putenv,  Prev: putc,  Up: Alphabetical List
  5232. `putchar'
  5233. =========
  5234. Syntax
  5235. ------
  5236.      #include <stdio.h>
  5237.      
  5238.      int putchar(int c);
  5239. Description
  5240. -----------
  5241. This is the same as `fputc(c, stdout)'.  *Note fputc::
  5242. Return Value
  5243. ------------
  5244. The character written.
  5245. Example
  5246. -------
  5247.      while ((c = getchar()) != EOF)
  5248.        putchar(c);
  5249. File: libcref,  Node: putenv,  Next: puts,  Prev: putchar,  Up: Alphabetical List
  5250. `putenv'
  5251. ========
  5252. Syntax
  5253. ------
  5254.      #include <stdlib.h>
  5255.      
  5256.      int putenv(const char *env);
  5257. Description
  5258. -----------
  5259. This function adds an entry to the program's environment.  The string
  5260. passed must be of the form `NAME'=`VALUE'.  Any existing value for the
  5261. environment variable is gone.
  5262. Note that the string passed to `putenv' becomes part of the environment
  5263. itself, so you must not free it.
  5264. Return Value
  5265. ------------
  5266. Zero on success, nonzero on failure.
  5267. Example
  5268. -------
  5269.      putenv("SHELL=ksh.exe");
  5270. File: libcref,  Node: puts,  Next: putw,  Prev: putenv,  Up: Alphabetical List
  5271. `puts'
  5272. ======
  5273. Syntax
  5274. ------
  5275.      #include <stdio.h>
  5276.      
  5277.      int puts(const char *string);
  5278. Description
  5279. -----------
  5280. This function writes STRING to `stdout', and then writes a newline
  5281. character.
  5282. Return Value
  5283. ------------
  5284. Nonnegative for success, or `EOF' on error.
  5285. Example
  5286. -------
  5287.      puts("Hello, there");
  5288. File: libcref,  Node: putw,  Next: qsort,  Prev: puts,  Up: Alphabetical List
  5289. `putw'
  5290. ======
  5291. Syntax
  5292. ------
  5293.      #include <stdio.h>
  5294.      
  5295.      int putw(int x, FILE *file);
  5296. Description
  5297. -----------
  5298. Writes a single binary word in native format to FILE.
  5299. Return Value
  5300. ------------
  5301. The value written, or `EOF' for end-of-file or error.  Since `EOF' is a
  5302. valid integer, you should use `feof' or `ferror' to detect this
  5303. situation.
  5304. Example
  5305. -------
  5306.      putw(12, stdout);
  5307. File: libcref,  Node: qsort,  Next: rand,  Prev: putw,  Up: Alphabetical List
  5308. `qsort'
  5309. =======
  5310. Syntax
  5311. ------
  5312.      #include <stdlib.h>
  5313.      
  5314.      void qsort(void *base, size_t numelem, size_t size,
  5315.                 int (*cmp)(const void *e1, const void *e2));
  5316. Description
  5317. -----------
  5318. This function sorts the given array in place.  BASE is the address of
  5319. the first of NUMELEM array entries, each of size SIZE bytes.  `qsort'
  5320. uses the supplied function CMP to determine the sort order for any two
  5321. elements by passing the address of the two elements and using the
  5322. function's return address.
  5323. The return address of the function indicates the sort order:
  5324. Negative
  5325.      Element E1 should come before element E2 in the resulting array.
  5326. Positive
  5327.      Element E1 should come after element E2 in the resulting array.
  5328.      It doesn't matter which element comes first in the resulting array.
  5329. Return Value
  5330. ------------
  5331. None.
  5332. Example
  5333. -------
  5334.      typedef struct {
  5335.        int size;
  5336.        int sequence;
  5337.      } Item;
  5338.      
  5339.      int qsort_helper_by_size(void *e1, void *e2)
  5340.      {
  5341.        return ((Item *)e2)->size - ((Item *)e1)->size;
  5342.      }
  5343.      
  5344.      Item list[100];
  5345.      
  5346.      qsort(list, 100, sizeof(Item), qsort_helper_by_size);
  5347.      
  5348.      int qsort_stringlist(void *e1, void *e2)
  5349.      {
  5350.        return strcmp(*(char **)e1, *(char **)e2);
  5351.      }
  5352.      
  5353.      char *slist[10];
  5354.      
  5355.      /* alphabetical order */
  5356.      qsort(slist, 10, sizeof(char *), qsort_stringlist);
  5357. File: libcref,  Node: rand,  Next: random,  Prev: qsort,  Up: Alphabetical List
  5358. `rand'
  5359. ======
  5360. Syntax
  5361. ------
  5362.      #include <stdlib.h>
  5363.      
  5364.      int rand(void);
  5365. Description
  5366. -----------
  5367. Returns a pseudo-random number from zero to `RAND_MAX'.
  5368. Return Value
  5369. ------------
  5370. The number.
  5371. Example
  5372. -------
  5373.      /* random pause */
  5374.      for (i=rand(); i; i--);
  5375. File: libcref,  Node: random,  Next: rawclock,  Prev: rand,  Up: Alphabetical List
  5376. `random'
  5377. ========
  5378. Syntax
  5379. ------
  5380.      #include <stdlib.h>
  5381.      
  5382.      long random(void);
  5383. Description
  5384. -----------
  5385. This is a better random number generator than `rand'.
  5386. Return Value
  5387. ------------
  5388. A random number from zero to `MAXINT'.
  5389. Example
  5390. -------
  5391.      for (i=random(); i; i>>=1);
  5392. File: libcref,  Node: rawclock,  Next: read,  Prev: random,  Up: Alphabetical List
  5393. `rawclock'
  5394. ==========
  5395. Syntax
  5396. ------
  5397.      unsigned long rawclock(void);
  5398. Description
  5399. -----------
  5400. Returns the number of clock tics (18.2 per second) since midnight.
  5401. Return Value
  5402. ------------
  5403. The number of tics.
  5404. Example
  5405. -------
  5406.      /* wait 1/4 second */
  5407.      int i = rawclock()+5;
  5408.      while (rawclock()<i);
  5409. File: libcref,  Node: read,  Next: readcr,  Prev: rawclock,  Up: Alphabetical List
  5410. `read'
  5411. ======
  5412. Syntax
  5413. ------
  5414.      #include <osfcn.h>
  5415.      
  5416.      int read(int fd, void *buffer, unsigned length);
  5417. Description
  5418. -----------
  5419. This function reads at most LENGTH bytes from file FD into BUFFER.
  5420. Note that in some cases, such as end-of-file conditions and text files,
  5421. it may read less than the requested number of bytes.  At end-of-file,
  5422. `read' will read exactly zero bytes.
  5423. Return Value
  5424. ------------
  5425. The number of bytes read, zero meaning end-of-file, or -1 for an error.
  5426. Example
  5427. -------
  5428.      char buf[10];
  5429.      int r = read(0, buf, 10);
  5430. File: libcref,  Node: readcr,  Next: readdir,  Prev: read,  Up: Alphabetical List
  5431. `readcr'
  5432. ========
  5433. Syntax
  5434. ------
  5435.      int readcr(int fd, char *buf, unsigned length);
  5436. Description
  5437. -----------
  5438. This is just like `read', but Ctrl-M characters are stripped from the
  5439. input.  This function often returns a number less than LENGTH due to
  5440. the dropping of characters.
  5441. Return Value
  5442. ------------
  5443. The number of characters read.
  5444. Example
  5445. -------
  5446.      char buf[100];
  5447.      int r = readcr(0, buf, 100);
  5448. File: libcref,  Node: readdir,  Next: readv,  Prev: readcr,  Up: Alphabetical List
  5449. `readdir'
  5450. =========
  5451. Syntax
  5452. ------
  5453.      #include <dirent.h>
  5454.      
  5455.      struct dirent *readdir(DIR *dir);
  5456. Description
  5457. -----------
  5458. This function reads entries from a directory opened by `opendir' (*Note
  5459. opendir::).  It returns the information in a static buffer with this
  5460. format:
  5461.      struct dirent {
  5462.        unsigned short d_namlen;  /* The length of the name (like strlen) */
  5463.        char d_name[MAXNAMLEN+1]; /* The name */
  5464.      };
  5465. Return Value
  5466. ------------
  5467. A pointer to a static buffer that is overridden with each call.
  5468. Example
  5469. -------
  5470.      DIR *d = opendir(".");
  5471.      struct dirent *de;
  5472.      while (de = readdir(d))
  5473.        puts(de->d_name);
  5474.      closedir(d);
  5475. File: libcref,  Node: readv,  Next: realloc,  Prev: readdir,  Up: Alphabetical List
  5476. `readv'
  5477. =======
  5478. Syntax
  5479. ------
  5480.      #include <sys/uio.h>
  5481.      
  5482.      int readv(int handle, struct iovec *iov, int count);
  5483. Description
  5484. -----------
  5485. This function is like `read', but is able to supply a list of buffers
  5486. to read into.  IOV is a pointer to an array of COUNT buffer definition
  5487. structures of this format:
  5488.      struct iovec {
  5489.        void *iov_base;
  5490.        unsigned long iov_len;
  5491.      };
  5492. Characters are read into successive buffers until the requested number
  5493. of characters are read or until no more data is available.
  5494. Return Value
  5495. ------------
  5496. The number of bytes read.
  5497. File: libcref,  Node: realloc,  Next: realloc_srchlen,  Prev: readv,  Up: Alphabetical List
  5498. `realloc'
  5499. =========
  5500. Syntax
  5501. ------
  5502.      #include <stdlib.h>
  5503.      
  5504.      void *realloc(void *ptr, size_t size);
  5505. Description
  5506. -----------
  5507. This function changes the size of the region pointed to by PTR.  If it
  5508. can, it will reuse the same memory space, but it may have to allocate a
  5509. new memory space to satisfy the request.  In either case, it will
  5510. return the pointer that you should use to refer to the (possibly new)
  5511. memory area.  The pointer passed may be `NULL', in which case this
  5512. function acts just like `malloc' (*Note malloc::).
  5513. Return Value
  5514. ------------
  5515. A pointer to the memory you should now refer to.
  5516. Example
  5517. -------
  5518.      if (now+new > max)
  5519.      {
  5520.        max = now+new;
  5521.        p = realloc(p, max);
  5522.      }
  5523. File: libcref,  Node: realloc_srchlen,  Next: remove,  Prev: realloc,  Up: Alphabetical List
  5524. `realloc_srchlen'
  5525. =================
  5526. Syntax
  5527. ------
  5528.      extern int realloc_srchlen;
  5529. Description
  5530. -----------
  5531. This value controls certain obscure and obsolete side effect of calling
  5532. `realloc' with an already-free'd pointer.  Best not to use it.
  5533. File: libcref,  Node: remove,  Next: remque,  Prev: realloc_srchlen,  Up: Alphabetical List
  5534. `remove'
  5535. ========
  5536. Syntax
  5537. ------
  5538.      #include <stdio.h>
  5539.      
  5540.      int remove(const char *file);
  5541. Description
  5542. -----------
  5543. This function removes the named FILE from the file system.  Unless you
  5544. have an un-erase program, the file and its contents are gone for good.
  5545. Return Value
  5546. ------------
  5547. Zero on success, nonzero on failure.
  5548. Example
  5549. -------
  5550.      remove("/tmp/data.tmp");
  5551. File: libcref,  Node: remque,  Next: rename,  Prev: remove,  Up: Alphabetical List
  5552. `remque'
  5553. ========
  5554. Syntax
  5555. ------
  5556.      void remque(struct vaxque *elem);
  5557. Description
  5558. -----------
  5559. Given a queue of elements derived from this structure:
  5560.      struct vaxque {
  5561.        struct vaxque *vq_next;
  5562.        struct vaxque *vq_prev;
  5563.      };
  5564. This function removes the given element from the queue.  This function
  5565. emulates the VAX `remque' opcode.  *Note insque::
  5566. Return Value
  5567. ------------
  5568. None.
  5569. File: libcref,  Node: rename,  Next: rewind,  Prev: remque,  Up: Alphabetical List
  5570. `rename'
  5571. ========
  5572. Syntax
  5573. ------
  5574.      #include <stdio.h>
  5575.      
  5576.      int rename(const char *oldname, const char *newname);
  5577. Description
  5578. -----------
  5579. This function renames an existing file OLDNAME to NEWNAME.  Wildcards
  5580. are not allowed, but the two file names may reflect different
  5581. subdirectories on the same file system.
  5582. Return Value
  5583. ------------
  5584. Zero on success, nonzero on failure.
  5585. Example
  5586. -------
  5587.      rename("some.doc", "some.sav");
  5588. File: libcref,  Node: rewind,  Next: rewinddir,  Prev: rename,  Up: Alphabetical List
  5589. `rewind'
  5590. ========
  5591. Syntax
  5592. ------
  5593.      #include <stdio.h>
  5594.      
  5595.      void rewind(FILE *file);
  5596. Description
  5597. -----------
  5598. This function repositions the file pointer to the beginning of the file
  5599. and clears the error indicator.
  5600. Return Value
  5601. ------------
  5602. None.
  5603. Example
  5604. -------
  5605.      rewind(stdin);
  5606. File: libcref,  Node: rewinddir,  Next: rindex,  Prev: rewind,  Up: Alphabetical List
  5607. `rewinddir'
  5608. ===========
  5609. Syntax
  5610. ------
  5611.      #include <dirent.h>
  5612.      
  5613.      void rewinddir(DIR *dir);
  5614. Description
  5615. -----------
  5616. This function resets the position of the DIR so that the next call to
  5617. `readdir' (*Note readdir::) starts at the beginning again.
  5618. Return Value
  5619. ------------
  5620. None.
  5621. Example
  5622. -------
  5623.      DIR *d = opendir(".");
  5624.      rewinddir(d);
  5625. File: libcref,  Node: rindex,  Next: rmdir,  Prev: rewinddir,  Up: Alphabetical List
  5626. `rindex'
  5627. ========
  5628. Syntax
  5629. ------
  5630.      #include <string.h>
  5631.      
  5632.      char *rindex(const char *string, int ch);
  5633. Description
  5634. -----------
  5635. Returns a pointer to the last occurrence of CH in STRING.  Note that
  5636. the `NULL' character counts, so if you pass zero as CH you'll get a
  5637. pointer to the end of the string back.
  5638. Return Value
  5639. ------------
  5640. A pointer to the character, or `NULL' if it wasn't found.
  5641. Example
  5642. -------
  5643.      char *extension = rindex(path, '.');
  5644.      if (extension)
  5645.        extension++;
  5646. File: libcref,  Node: rmdir,  Next: sbrk,  Prev: rindex,  Up: Alphabetical List
  5647. `rmdir'
  5648. =======
  5649. Syntax
  5650. ------
  5651.      #include <osfcn.h>
  5652.      
  5653.      int rmdir(const char *dirname);
  5654. Description
  5655. -----------
  5656. This function removes directory DIRNAME.  The directory must be empty.
  5657. Return Value
  5658. ------------
  5659. Zero if the directory was removed, nonzero on failure.
  5660. Example
  5661. -------
  5662.      rmdir("/tmp/datadir");
  5663. File: libcref,  Node: sbrk,  Next: scanf,  Prev: rmdir,  Up: Alphabetical List
  5664. `sbrk'
  5665. ======
  5666. Syntax
  5667. ------
  5668.      #include <osfcn.h>
  5669.      
  5670.      void *sbrk(int delta)
  5671. Description
  5672. -----------
  5673. This function changes the "break" of the program by adding DELTA to it.
  5674. This is the highest address that your program can access without
  5675. causing a violation.  Since the heap is the region under the break, you
  5676. can expand the heap (where `malloc' gets memory from) by increasing the
  5677. break.
  5678. This function is normally accessed only bu `malloc' (*Note malloc::).
  5679. Return Value
  5680. ------------
  5681. The address of the first byte outside of the valid address range, or -1
  5682. if no more memory could be accessed.
  5683. Example
  5684. -------
  5685.      char *buf;
  5686.      buf = sbrk(1000); /* allocate space */
  5687. File: libcref,  Node: scanf,  Next: seekdir,  Prev: sbrk,  Up: Alphabetical List
  5688. `scanf'
  5689. =======
  5690. Syntax
  5691. ------
  5692.      #include <stdio.h>
  5693.      
  5694.      int scanf(const char *format, ...);
  5695. Description
  5696. -----------
  5697. This function scans formatted text from `stdin' and stores it in the
  5698. variables pointed to by the arguments.  *Note scanf::
  5699. The format string contains regular characters which much match the input
  5700. exactly as well as a conversion specifiers, which begin with a percent
  5701. symbol.  Any whitespace in the format string matches zero or more of any
  5702. whitespace characters in the input.  Thus, a single space may match a
  5703. newline and two tabs in the input.  All conversions except `c' and `['
  5704. also skip leading whitespace automatically.  Each conversion specifier
  5705. contains the following fields:
  5706.    *  An asterisk (`*') which indicates that the input should be
  5707.      converted according to the conversion spec, but not stored
  5708.      anywhere.
  5709.    *  A width specifier, which specifies the maximum number of input
  5710.      characters to use in the conversion.
  5711.    *  An optional conversion qualifier, which may be `h' to specify
  5712.      `short' or `l' or `L' to specify `long'.
  5713.    *  The conversion type specifier:
  5714.     `c'
  5715.           Copy the next character (or WIDTH characters) to the given
  5716.           buffer.
  5717.     `d'
  5718.           Convert the input to a signed integer.
  5719.     `e'
  5720.     `E'
  5721.     `f'
  5722.     `g'
  5723.     `G'
  5724.           Convert the input to a floating point number.
  5725.     `i'
  5726.           Convert the input, determining base automatically by the
  5727.           presence of `0x' or `0' prefixes.  *Note strtol::
  5728.     `n'
  5729.           Store the number of characters scanned so far into the
  5730.           integer pointed to.
  5731.     `o'
  5732.           Convert the input to a signed integer, using base 8.
  5733.     `p'
  5734.           Convert the input to a pointer.  This is like using the `x'
  5735.           format.
  5736.     `s'
  5737.           Copy the input to the given string, skipping leading
  5738.           whitespace and copying non-whitespace characters up to the
  5739.           next whitespace.  The string stored is then `NULL'-terminated.
  5740.     `u'
  5741.           Convert the input to an unsigned integer.
  5742.     `x'
  5743.     `X'
  5744.           Convert the input to an unsigned integer, using base 16.
  5745.     `[...]'
  5746.           Like the `c' format, except only certain characters are
  5747.           copied.  The characters between the brackets determine which
  5748.           characters are allowed, and thus when the copying stops.
  5749.           These characters may be regular characters (example:
  5750.           `[abcd]') or a range of characters (example: `[a-d]').  If
  5751.           the first character is a caret (`^'), then the set specifies
  5752.           the set of characters that do not get copied (i.e.  the set
  5753.           is negated).  To specify that the set contains a
  5754.           close-bracket (`]'), list that as the first regular character.
  5755.     `%'
  5756.           This must match a percent character in the input.
  5757. Most conversions make use of `strtol' or `strtoul' to perform the
  5758. actual conversions.
  5759. Return Value
  5760. ------------
  5761. The number of items successfully scanned.
  5762. Example
  5763. -------
  5764.      int x, y;
  5765.      char buf[100];
  5766.      scanf("%d %d %s", &x, &y, buf);
  5767.      
  5768.      /* read to end-of-line */
  5769.      scanf("%d %[^\n]\n", &x, buf);
  5770.      /* read letters only */
  5771.      scanf("[a-zA-Z]", buf);
  5772. File: libcref,  Node: seekdir,  Next: setbuf,  Prev: scanf,  Up: Alphabetical List
  5773. `seekdir'
  5774. =========
  5775. Syntax
  5776. ------
  5777.      #include <dirent.h>
  5778.      
  5779.      void seekdir(DIR *dir, long loc);
  5780. Description
  5781. -----------
  5782. This function sets the location pointer in DIR to the specified LOC.
  5783. Note that the value used for LOC should be either zero or a value
  5784. returned by `telldir' (*Note telldir::).  The next call to `readdir'
  5785. (*Note readdir::) will read whatever entry follows that point in the
  5786. directory.
  5787. Return Value
  5788. ------------
  5789. None.
  5790. Example
  5791. -------
  5792.      int q = telldir(dir);
  5793.      do_stuff();
  5794.      seekdir(dir, q);
  5795. File: libcref,  Node: setbuf,  Next: setbuffer,  Prev: seekdir,  Up: Alphabetical List
  5796. `setbuf'
  5797. ========
  5798. Syntax
  5799. ------
  5800.      #include <stdio.h>
  5801.      
  5802.      void setbuf(FILE *file, char *buffer);
  5803. Description
  5804. -----------
  5805. This function modifies the buffering characteristics of FILE.  First,
  5806. if the file already has a buffer, it is freed.  If there was any
  5807. pending data in it, it is lost, so this function should only be used
  5808. immediately after a call to `fopen'.
  5809. If the BUFFER passed is `NULL', the file is set to unbuffered.  If a
  5810. non-`NULL' buffer is passed, it must be at least `BUFSIZ' bytes in
  5811. size, and the file is set to fully buffered.
  5812. *Note setbuffer:: *Note setlinebuf:: *Note setvbuf::
  5813. Return Value
  5814. ------------
  5815. None.
  5816. Example
  5817. -------
  5818.      setbuf(stdout, malloc(BUFSIZ));
  5819. File: libcref,  Node: setbuffer,  Next: setcbrk,  Prev: setbuf,  Up: Alphabetical List
  5820. `setbuffer'
  5821. ===========
  5822. Syntax
  5823. ------
  5824.      #include <stdio.h>
  5825.      
  5826.      void setbuffer(FILE *file, char *buffer, int length);
  5827. Description
  5828. -----------
  5829. This function modifies the buffering characteristics of FILE.  First,
  5830. if the file already has a buffer, it is freed.  If there was any
  5831. pending data in it, it is lost, so this function should only be used
  5832. immediately after a call to `fopen'.
  5833. If the BUFFER passed is `NULL', the file is set to unbuffered.  If a
  5834. non-`NULL' buffer is passed, it must be at least SIZE bytes in size,
  5835. and the file is set to fully buffered.
  5836. *Note setbuf:: *Note setlinebuf:: *Note setvbuf::
  5837. Return Value
  5838. ------------
  5839. None.
  5840. Example
  5841. -------
  5842.      setbuffer(stdout, malloc(10000), 10000);
  5843. File: libcref,  Node: setcbrk,  Next: setdate,  Prev: setbuffer,  Up: Alphabetical List
  5844. `setcbrk'
  5845. =========
  5846. Syntax
  5847. ------
  5848.      #include <dos.h>
  5849.      
  5850.      void setcbrk(int check);
  5851. Description
  5852. -----------
  5853. Set the setting of the Ctrl-Break checking flag in MS-DOS.  If CHECK is
  5854. zero, checking is not done.  If nonzero, checking is done.
  5855. Return Value
  5856. ------------
  5857. None.
  5858. File: libcref,  Node: setdate,  Next: setdisk,  Prev: setcbrk,  Up: Alphabetical List
  5859. `setdate'
  5860. =========
  5861. Syntax
  5862. ------
  5863.      #include <dos.h>
  5864.      
  5865.      void setdate(struct date *ptr);
  5866. Description
  5867. -----------
  5868. This function sets the current time.
  5869. *Note getdate:: *Note settime::
  5870. Return Value
  5871. ------------
  5872. None.
  5873. Example
  5874. -------
  5875.      struct date d;
  5876.      setdate(&d);
  5877. File: libcref,  Node: setdisk,  Next: setenv,  Prev: setdate,  Up: Alphabetical List
  5878. `setdisk'
  5879. =========
  5880. Syntax
  5881. ------
  5882.      #include <dir.h>
  5883.      
  5884.      int setdisk(int drive);
  5885. Description
  5886. -----------
  5887. This function sets the current disk (0=A).
  5888. *Note getdisk::
  5889. Return Value
  5890. ------------
  5891. The total number of possible drives.
  5892. Example
  5893. -------
  5894.      printf("There are %d drives\n", setdisk(getdisk()));
  5895. File: libcref,  Node: setenv,  Next: setftime,  Prev: setdisk,  Up: Alphabetical List
  5896. `setenv'
  5897. ========
  5898. Syntax
  5899. ------
  5900.      #include <stdlib.h>
  5901.      
  5902.      int setenv(const char *name, const char *value, int rewrite);
  5903. Description
  5904. -----------
  5905. Sets the environment variable NAME to VALUE.  If REWRITE is set, then
  5906. this function will replace any existing value.  If it is not set, it
  5907. will replace the existing value only if the new value is shorter than
  5908. the old.
  5909. Return Value
  5910. ------------
  5911. 0 on success, nonzero on failure.
  5912. Example
  5913. -------
  5914.      setenv("TERM", "xterm", 1);
  5915. File: libcref,  Node: setftime,  Next: setgrent,  Prev: setenv,  Up: Alphabetical List
  5916. `setftime'
  5917. ==========
  5918. Syntax
  5919. ------
  5920.      #include <dos.h>
  5921.      
  5922.      int setftime(int handle, struct ftime *ftimep);
  5923. Description
  5924. -----------
  5925. This function sets the modification time of a file.  Note that since
  5926. writing to a file, and closing a file opened for writing, also sets the
  5927. modification time, you should only use this function on files opened for
  5928. reading.
  5929. *Note getftime::
  5930. Return Value
  5931. ------------
  5932. Zero on success, nonzero on failure.
  5933. Example
  5934. -------
  5935.      int q = open("data.txt", O_RDONLY);
  5936.      struct ftime f;
  5937.      f.ft_sec = f.ft_min = f.ft_hour = f.ft_day = f.ft_month = f.ft_year = 0;
  5938.      setftime(q, &f);
  5939.      close(q);
  5940. File: libcref,  Node: setgrent,  Next: setjmp,  Prev: setftime,  Up: Alphabetical List
  5941. `setgrent'
  5942. ==========
  5943. Syntax
  5944. ------
  5945.      #include <grp.h>
  5946.      
  5947.      void setgrent(void);
  5948. Description
  5949. -----------
  5950. This function should be called before any call to getgrent, getgrgid, or
  5951. getgrnam.  *Note getgrent::
  5952. Return Value
  5953. ------------
  5954. None.
  5955. File: libcref,  Node: setjmp,  Next: setlinebuf,  Prev: setgrent,  Up: Alphabetical List
  5956. `setjmp'
  5957. ========
  5958. Syntax
  5959. ------
  5960.      #include <setjmp.h>
  5961.      
  5962.      int setjmp(jmp_buf j);
  5963. Description
  5964. -----------
  5965. This function stores the complete CPU state into J.  This information
  5966. is complete enough that `longjmp' (*Note longjmp::) can return the
  5967. program to that state.  It is also complete enough to implement
  5968. coroutines.
  5969. Return Value
  5970. ------------
  5971. This function will return zero if it is returning from it's own call.
  5972. If longjmp is used to restore the state, it will return whatever value
  5973. was passed to longjmp, except if zero is passed to longjmp it will
  5974. return one.
  5975. Example
  5976. -------
  5977.      jmp_buf j;
  5978.      if (setjmp(j))
  5979.        return;
  5980.      do_something();
  5981.      longjmp(j);
  5982. File: libcref,  Node: setlinebuf,  Next: setmntent,  Prev: setjmp,  Up: Alphabetical List
  5983. `setlinebuf'
  5984. ============
  5985. Syntax
  5986. ------
  5987.      #include <stdio.h>
  5988.      
  5989.      void setlinebuf(FILE *file);
  5990. Description
  5991. -----------
  5992. This function modifies the buffering characteristics of FILE.  First,
  5993. if the file already has a buffer, it is freed.  If there was any
  5994. pending data in it, it is lost, so this function should only be used
  5995. immediately after a call to `fopen'.
  5996. Next, a buffer is allocated and the file is set to line buffering.
  5997. *Note setbuf:: *Note setlinebuf:: *Note setvbuf::
  5998. Return Value
  5999. ------------
  6000. None.
  6001. Example
  6002. -------
  6003.      setlinebuf(stderr);
  6004. File: libcref,  Node: setmntent,  Next: _setmode,  Prev: setlinebuf,  Up: Alphabetical List
  6005. `setmntent'
  6006. ===========
  6007. Syntax
  6008. ------
  6009.      #include <mntent.h>
  6010.      
  6011.      FILE *setmntent(char *filename, char *type);
  6012. Description
  6013. -----------
  6014. This function returns an open FILE* pointer which can be used by
  6015. getmntent (*Note getmntent::).
  6016. Return Value
  6017. ------------
  6018. The FILE* pointer is returned.  For MS-DOS, this FILE* is not a real
  6019. pointer and may only be used by `getmntent'.
  6020. File: libcref,  Node: _setmode,  Next: setmode,  Prev: setmntent,  Up: Alphabetical List
  6021. `_setmode'
  6022. ==========
  6023. Syntax
  6024. ------
  6025.      int _setmode(int file, int mode);
  6026. Description
  6027. -----------
  6028. This function sets the mode of the given FILE to MODE, which is either
  6029. `O_TEXT' or `O_BINARY'.  It will also set the file into either cooked
  6030. or raw mode accordingly.
  6031. This function will not affect any `FILE*' objects using it.
  6032. Return Value
  6033. ------------
  6034. Zero on success, nonzero on failure.
  6035. Example
  6036. -------
  6037.      _setmode(0, O_BINARY);
  6038. File: libcref,  Node: setmode,  Next: setpwent,  Prev: _setmode,  Up: Alphabetical List
  6039. `setmode'
  6040. =========
  6041. Syntax
  6042. ------
  6043.      #include <io.h>
  6044.      
  6045.      int setmode(int file, int mode);
  6046. Description
  6047. -----------
  6048. This function sets the mode of the given FILE to MODE, which is either
  6049. `O_TEXT' or `O_BINARY'.  It will also set the file into either cooked
  6050. or raw mode accordingly, and set any `FILE*' objects that use this file
  6051. into text or binary mode.
  6052. Return Value
  6053. ------------
  6054. Zero on success, nonzero on failure.
  6055. Example
  6056. -------
  6057.      setmode(0, O_BINARY);
  6058. File: libcref,  Node: setpwent,  Next: _setstack,  Prev: setmode,  Up: Alphabetical List
  6059. `setpwent'
  6060. ==========
  6061. Syntax
  6062. ------
  6063.      #include <pwd.h>
  6064.      
  6065.      void setpwent(void);
  6066. Description
  6067. -----------
  6068. This function reinitializes `getpwent' so that scanning will start from
  6069. the start of the list.  *Note getpwent::
  6070. Return Value
  6071. ------------
  6072. None.
  6073. File: libcref,  Node: _setstack,  Next: setstate,  Prev: setpwent,  Up: Alphabetical List
  6074. `_setstack'
  6075. ===========
  6076. Description
  6077. -----------
  6078. This is an internal function used to set the size of the stack in DPMI
  6079. mode.
  6080. *Note _stklen::
  6081. File: libcref,  Node: setstate,  Next: settime,  Prev: _setstack,  Up: Alphabetical List
  6082. `setstate'
  6083. ==========
  6084. Syntax
  6085. ------
  6086.      #include <stdlib.h>
  6087.      
  6088.      char *setstate(char *state);
  6089. Description
  6090. -----------
  6091. This function initializes the random number generator (*Note random::).
  6092. For more details, consult the source code `libsrc/c/gen/random.c'.
  6093. Return Value
  6094. ------------
  6095. The old state.
  6096. File: libcref,  Node: settime,  Next: settimeofday,  Prev: setstate,  Up: Alphabetical List
  6097. `settime'
  6098. =========
  6099. Syntax
  6100. ------
  6101.      #include <dos.h>
  6102.      
  6103.      void settime(struct time *ptr);
  6104. Description
  6105. -----------
  6106. This function sets the current time.
  6107. *Note gettime:: *Note setdate::
  6108. Return Value
  6109. ------------
  6110. None.
  6111. Example
  6112. -------
  6113.      struct time t;
  6114.      settime(&t);
  6115. File: libcref,  Node: settimeofday,  Next: setvbuf,  Prev: settime,  Up: Alphabetical List
  6116. `settimeofday'
  6117. ==============
  6118. Syntax
  6119. ------
  6120.      #include <sys/time.h>
  6121.      
  6122.      int settimeofday(struct timeval *tp, struct timezone *tzp);
  6123. Description
  6124. -----------
  6125. Sets the current GMT time and the local timezone information.  *Note
  6126. gettimeofday:: for information on the structure types.
  6127. Return Value
  6128. ------------
  6129. Zero if the time was set, nonzero on error.
  6130. File: libcref,  Node: setvbuf,  Next: sigaction,  Prev: settimeofday,  Up: Alphabetical List
  6131. `setvbuf'
  6132. =========
  6133. Syntax
  6134. ------
  6135.      #include <stdio.h>
  6136.      
  6137.      int setvbuf(FILE *file, char *buffer, int type, int length);
  6138. Description
  6139. -----------
  6140. This function modifies the buffering characteristics of FILE.  First,
  6141. if the file already has a buffer, it is freed.  If there was any
  6142. pending data in it, it is lost, so this function should only be used
  6143. immediately after a call to `fopen'.
  6144. If the TYPE is `_IONBF', the BUFFER and LENGTH are ignored and the file
  6145. is set to unbuffered mode.
  6146. If the TYPE is `_IOLBF' or `_IOFBF', then the file is set to line or
  6147. fully buffered, respectively.  If BUFFER is `NULL', a buffer of size
  6148. SIZE is created and used as the buffer.  If BUFFER is non-`NULL', it
  6149. must point to a buffer of at least size SIZE and will be used as the
  6150. buffer.
  6151. *Note setbuf:: *Note setbuffer:: *Note setlinebuf::
  6152. Return Value
  6153. ------------
  6154. Zero on success, nonzero on failure.
  6155. Example
  6156. -------
  6157.      setbuf(stderr, NULL, _IOLBF, 1000);
  6158. File: libcref,  Node: sigaction,  Next: sigaddset,  Prev: setvbuf,  Up: Alphabetical List
  6159. `sigaction'
  6160. ===========
  6161. Description
  6162. -----------
  6163. This function is provided only to assist in porting from Unix.  It
  6164. always returns an error condition.
  6165. File: libcref,  Node: sigaddset,  Next: sigdelset,  Prev: sigaction,  Up: Alphabetical List
  6166. `sigaddset'
  6167. ===========
  6168. Description
  6169. -----------
  6170. This function is provided only to assist in porting from Unix.  It
  6171. always returns an error condition.
  6172. File: libcref,  Node: sigdelset,  Next: sigemptyset,  Prev: sigaddset,  Up: Alphabetical List
  6173. `sigdelset'
  6174. ===========
  6175. Description
  6176. -----------
  6177. This function is provided only to assist in porting from Unix.  It
  6178. always returns an error condition.
  6179. File: libcref,  Node: sigemptyset,  Next: sigfillset,  Prev: sigdelset,  Up: Alphabetical List
  6180. `sigemptyset'
  6181. =============
  6182. Description
  6183. -----------
  6184. This function is provided only to assist in porting from Unix.  It
  6185. always returns an error condition.
  6186. File: libcref,  Node: sigfillset,  Next: sigismember,  Prev: sigemptyset,  Up: Alphabetical List
  6187. `sigfillset'
  6188. ============
  6189. Description
  6190. -----------
  6191. This function is provided only to assist in porting from Unix.  It
  6192. always returns an error condition.
  6193. File: libcref,  Node: sigismember,  Next: signal,  Prev: sigfillset,  Up: Alphabetical List
  6194. `sigismember'
  6195. =============
  6196. Description
  6197. -----------
  6198. This function is provided only to assist in porting from Unix.  It
  6199. always returns an error condition.
  6200. File: libcref,  Node: signal,  Next: sigsetmask,  Prev: sigismember,  Up: Alphabetical List
  6201. `signal'
  6202. ========
  6203. Description
  6204. -----------
  6205. This function is provided only to assist in porting from Unix.  It
  6206. always returns an error condition.
  6207. File: libcref,  Node: sigsetmask,  Next: sleep,  Prev: signal,  Up: Alphabetical List
  6208. `sigsetmask'
  6209. ============
  6210. Description
  6211. -----------
  6212. This function is provided only to assist in porting from Unix.  It
  6213. always returns an error condition.
  6214. File: libcref,  Node: sleep,  Next: _smallbuf,  Prev: sigsetmask,  Up: Alphabetical List
  6215. `sleep'
  6216. =======
  6217. Syntax
  6218. ------
  6219.      #include <osfcn.h>
  6220.      
  6221.      unsigned sleep(unsigned seconds);
  6222. Description
  6223. -----------
  6224. This function causes the program to pause for SECONDS seconds.
  6225. Return Value
  6226. ------------
  6227. The number of seconds that haven't passed (i.e. always zero)
  6228. Example
  6229. -------
  6230.      sleep(5);
  6231. File: libcref,  Node: _smallbuf,  Next: spawn*,  Prev: sleep,  Up: Alphabetical List
  6232. `_smallbuf'
  6233. ===========
  6234. Description
  6235. -----------
  6236. This is an internal variable used by `fopen'.
  6237. File: libcref,  Node: spawn*,  Next: sprintf,  Prev: _smallbuf,  Up: Alphabetical List
  6238. `spawn*'
  6239. ========
  6240. Syntax
  6241. ------
  6242.      #include <process.h>
  6243.      
  6244.      int spawnl(int mode, const char *path, const char *argv0, ...);
  6245.      int spawnle(int mode, const char *path, const char *argv0, ... /*, const char **envp */);
  6246.      int spawnlp(int mode, const char *path, const char *argv0, ...);
  6247.      int spawnlpe(int mode, const char *path, const char *argv0, ... /*, const char **envp */);
  6248.      
  6249.      int spawnv(int mode, const char *path, const char **argv);
  6250.      int spawnve(int mode, const char *path, const char **argv, const char **envp);
  6251.      int spawnvp(int mode, const char *path, const char **argv);
  6252.      int spawnvpe(int mode, const char *path, const char **argv, const char **envp);
  6253. Description
  6254. -----------
  6255. These functions run other programs.  The PATH points to the program to
  6256. run.  The extension is optional - if not given, the usual extensions
  6257. `.com', `.exe', and `.bat' are checked.
  6258. The programs are invoked with the arguments given.  The zeroth argument
  6259. is normally not used, since MS-DOS cannot pass it separately.  There are
  6260. two ways of passing arguments.  The `l' functions (like `execlp') take
  6261. a list of arguments, with a zero at the end of the list.  This is
  6262. useful when you know how many argument there will be ahead of time.
  6263. The `v' functions (like `execve') take a pointer to a list of
  6264. arguments.  This is useful when you need to compute the number of
  6265. arguments at runtime.
  6266. In either case, you may also specify `e' to indicate that you will be
  6267. giving an explicit environment, else the current environment is used.
  6268. You may also specify `p' to indicate that you would like `exec*' to
  6269. search the PATH (in either the environment you pass or the current
  6270. environment) for the executable, else it will only check the explicit
  6271. path given.
  6272. Note that these function understand about other djgpp programs, and will
  6273. call go32 directly, so that you can pass command lines longer than 128
  6274. characters to them without any special code.
  6275. *Note exec*::
  6276. Return Value
  6277. ------------
  6278. If successful and `mode' is `P_WAIT', these functions return the exit
  6279. code of the child process.
  6280. If successful and MODE is `P_OVERLAY', these functions will not return.
  6281. If there is an error, these functions return -1 and set `errno' to
  6282. indicate the error.
  6283. Example
  6284. -------
  6285.      char *environ[] = {
  6286.        "PATH=c:\\dos;c:\\djgpp;c:\\usr\\local\\bin",
  6287.        "DJGPP=c:/djgpp",
  6288.        0
  6289.      };
  6290.      
  6291.      char *args[] = {
  6292.        "gcc",
  6293.        "-v",
  6294.        "hello.c",
  6295.        0
  6296.      };
  6297.      
  6298.      spawnvpe("gcc", args, environ);
  6299. File: libcref,  Node: sprintf,  Next: srand,  Prev: spawn*,  Up: Alphabetical List
  6300. `sprintf'
  6301. =========
  6302. Syntax
  6303. ------
  6304.      #include <stdio.h>
  6305.      
  6306.      int sprintf(char *buffer, const char *format, ...);
  6307. Description
  6308. -----------
  6309. Sends formatted output from the arguments (...) to the BUFFER.  *Note
  6310. printf::
  6311. Return Value
  6312. ------------
  6313. The number of characters written.
  6314. File: libcref,  Node: srand,  Next: srandom,  Prev: sprintf,  Up: Alphabetical List
  6315. `srand'
  6316. =======
  6317. Syntax
  6318. ------
  6319.      #include <stdlib.h>
  6320.      
  6321.      void srand(unsigned seed);
  6322. Description
  6323. -----------
  6324. This function initialized the random number generator (*Note rand::).
  6325. Passing the same SEED results in `rand' returning predictable sequences
  6326. of numbers.
  6327. Return Value
  6328. ------------
  6329. None.
  6330. Example
  6331. -------
  6332.      srand(45);
  6333. File: libcref,  Node: srandom,  Next: sscanf,  Prev: srand,  Up: Alphabetical List
  6334. `srandom'
  6335. =========
  6336. Syntax
  6337. ------
  6338.      #include <stdlib.h>
  6339.      
  6340.      void srandom(int seed);
  6341. Description
  6342. -----------
  6343. This function initialized the random number generator (*Note random::).
  6344. Passing the same SEED results in `random' returning predictable
  6345. sequences of numbers.
  6346. Return Value
  6347. ------------
  6348. None.
  6349. Example
  6350. -------
  6351.      srandom(45);
  6352. File: libcref,  Node: sscanf,  Next: stat,  Prev: srandom,  Up: Alphabetical List
  6353. `sscanf'
  6354. ========
  6355. Syntax
  6356. ------
  6357.      #include <stdio.h>
  6358.      
  6359.      int sscanf(const char *string, const char *format, ...);
  6360. Description
  6361. -----------
  6362. This function scans formatted text from the STRING and stores it in the
  6363. variables pointed to by the arguments.  *Note scanf::
  6364. Return Value
  6365. ------------
  6366. The number of items successfully scanned.
  6367. File: libcref,  Node: stat,  Next: stat_assist,  Prev: sscanf,  Up: Alphabetical List
  6368. `stat'
  6369. ======
  6370. Syntax
  6371. ------
  6372.      #include <sys/stat.h>
  6373.      
  6374.      int stat(const char *file, struct stat *sbuf);
  6375. Description
  6376. -----------
  6377. This function obtains the status of the file FILE and stores it in
  6378. SBUF, which has this structure:
  6379.      struct  stat {
  6380.              short    st_dev;         /* The drive number */
  6381.              short    st_ino;         /* a unique identifier */
  6382.              unsigned short st_mode;  /* file mode - S_IF* and S_IREAD/S_IWRITE */
  6383.              short    st_nlink;       /* 1 */
  6384.              short    st_uid;         /* getuid() */
  6385.              short    st_gid;         /* getgid() */
  6386.              short    st_rdev;        /* the drive number */
  6387.              short    st_align_for_word32;
  6388.              long     st_size;        /* size of file in bytes */
  6389.              long     st_atime;       /* time of last modification */
  6390.              long     st_mtime;       /*            ''             */
  6391.              long     st_ctime;       /*            ''             */
  6392.              long     st_blksize;     /* 512 */
  6393.      };
  6394. Return Value
  6395. ------------
  6396. Zero on success, nonzero on failure.
  6397. Example
  6398. -------
  6399.      struct stat s;
  6400.      stat("data.txt", &s);
  6401.      if (S_ISDIR(s.st_mode))
  6402.        printf("is directory\n");
  6403. File: libcref,  Node: stat_assist,  Next: statfs,  Prev: stat,  Up: Alphabetical List
  6404. `stat_assist'
  6405. =============
  6406. Description
  6407. -----------
  6408. This is an internal function used by `stat'.
  6409. File: libcref,  Node: statfs,  Next: _stklen,  Prev: stat_assist,  Up: Alphabetical List
  6410. `statfs'
  6411. ========
  6412. Syntax
  6413. ------
  6414.      #include <sys/vfs.h>
  6415.      
  6416.      int statfs(const char *filename, struct statfs *buf);
  6417. Description
  6418. -----------
  6419. This function returns information about the given "filesystem".  The
  6420. drive letter of the given FILENAME, or the default drive if none is
  6421. given, is used to retrieve the following structure:
  6422.      struct statfs
  6423.      {
  6424.          long    f_type;   /* 0 */
  6425.          long    f_bsize;  /* bytes per cluster */
  6426.          long    f_blocks; /* clusters on drive */
  6427.          long    f_bfree;  /* available clusters */
  6428.          long    f_bavail; /* available clusters */
  6429.          long    f_files;  /* clusters on drive */
  6430.          long    f_ffree;  /* available clusters */
  6431.          fsid_t    f_fsid;   /* [0]=drive_number, [1]=MOUNT_UFS
  6432.          long    f_magic;  /* FS_MAGIC */
  6433.      };
  6434. Return Value
  6435. ------------
  6436. Zero on success, nonzero on failure.
  6437. Example
  6438. -------
  6439.      struct statfs fs;
  6440.      statfs("anything", &fs);
  6441.      printf("%d bytes left\n", fs.f_bfree * fs.f_bsize);
  6442. File: libcref,  Node: _stklen,  Next: strcasecmp,  Prev: statfs,  Up: Alphabetical List
  6443. `_stklen'
  6444. =========
  6445. Syntax
  6446. ------
  6447.      extern int _stklen;
  6448. Description
  6449. -----------
  6450. This variable sets the minimum stack length that the program requires.
  6451. Note that the stack may be much larger than this.  This value should be
  6452. set statically, as it is only used at startup.
  6453. Example
  6454. -------
  6455.      extern int _stklen = 256000;
  6456. File: libcref,  Node: strcasecmp,  Next: strcat,  Prev: _stklen,  Up: Alphabetical List
  6457. `strcasecmp'
  6458. ============
  6459. Syntax
  6460. ------
  6461.      #include <string.h>
  6462.      
  6463.      int strcasecmp(const char *s1, const char *s2);
  6464. Description
  6465. -----------
  6466. This function compares the two strings, disregarding case.
  6467. Return Value
  6468. ------------
  6469. Zero if they're the same, nonzero if different, the sign indicates
  6470. "order".
  6471. Example
  6472. -------
  6473.      if (strcasecmp(arg, "-i") == 0)
  6474.        do_include();
  6475. File: libcref,  Node: strcat,  Next: strchr,  Prev: strcasecmp,  Up: Alphabetical List
  6476. `strcat'
  6477. ========
  6478. Syntax
  6479. ------
  6480.      #include <string.h>
  6481.      
  6482.      char *strcat(char *s1, const char *s2);
  6483. Description
  6484. -----------
  6485. This function concatenates S2 to the end of S1.
  6486. Return Value
  6487. ------------
  6488. Example
  6489. -------
  6490.      char buf[100] = "hello";
  6491.      strcat(buf, " there");
  6492. File: libcref,  Node: strchr,  Next: strcmp,  Prev: strcat,  Up: Alphabetical List
  6493. `strchr'
  6494. ========
  6495. Syntax
  6496. ------
  6497.      #include <string.h>
  6498.      
  6499.      char *strchr(const char *s, int c);
  6500. Description
  6501. -----------
  6502. This function returns a pointer to the first occurrence of C in S.
  6503. Note that if C is `NULL', this will return a pointer to the end of the
  6504. string.
  6505. Return Value
  6506. ------------
  6507. A pointer to the character, or `NULL' if it wasn't found.
  6508. Example
  6509. -------
  6510.      char *slash = strchr(filename, '/');
  6511. File: libcref,  Node: strcmp,  Next: strcoll,  Prev: strchr,  Up: Alphabetical List
  6512. `strcmp'
  6513. ========
  6514. Syntax
  6515. ------
  6516.      #include <string.h>
  6517.      
  6518.      int strcmp(const char *s1, const char *s2);
  6519. Description
  6520. -----------
  6521. This function compares S1 and S2.
  6522. Return Value
  6523. ------------
  6524. Zero if the strings are equal, a positive number if S1 comes after S2
  6525. in the ASCII collating sequense, else a negative number.
  6526. Example
  6527. -------
  6528.      if (strcmp(arg, "-i") == 0)
  6529.        do_include();
  6530. File: libcref,  Node: strcoll,  Next: strcpy,  Prev: strcmp,  Up: Alphabetical List
  6531. `strcoll'
  6532. =========
  6533. Syntax
  6534. ------
  6535.      #include <string.h>
  6536.      
  6537.      int strcoll(const char *s1, const char *s2);
  6538. Description
  6539. -----------
  6540. This function compares S1 and S2, using the collating sequences from
  6541. the current locale.
  6542. Return Value
  6543. ------------
  6544. Zero if the strings are equal, a positive number if S1 comes after S2
  6545. in the collating sequense, else a negative number.
  6546. Example
  6547. -------
  6548.      while (strcoll(var, list[i]) < 0)
  6549.        i++;
  6550. File: libcref,  Node: strcpy,  Next: strcspn,  Prev: strcoll,  Up: Alphabetical List
  6551. `strcpy'
  6552. ========
  6553. Syntax
  6554. ------
  6555.      #include <string.h>
  6556.      
  6557.      char *strcpy(char *s1, const char *s2);
  6558. Description
  6559. -----------
  6560. This function copies S2 into S1.
  6561. Return Value
  6562. ------------
  6563. Example
  6564. -------
  6565.      char buf[100];
  6566.      strcpy(buf, arg);
  6567. File: libcref,  Node: strcspn,  Next: strdup,  Prev: strcpy,  Up: Alphabetical List
  6568. `strcspn'
  6569. =========
  6570. Syntax
  6571. ------
  6572.      #include <string.h>
  6573.      
  6574.      size_t strcspn(const char *s1, const char *set);
  6575. Description
  6576. -----------
  6577. This function finds the first character in S1 that matches any
  6578. character in SET.  Note that the `NULL' bytes at the end of each string
  6579. counts, so you'll at least get a pointer to the end of the string if
  6580. nothing else.
  6581. Return Value
  6582. ------------
  6583. The index of the found character.
  6584. Example
  6585. -------
  6586.      int i = strcspn(command, "<>|");
  6587.      if (command[i])
  6588.        do_redirection();
  6589. File: libcref,  Node: strdup,  Next: strerror,  Prev: strcspn,  Up: Alphabetical List
  6590. `strdup'
  6591. ========
  6592. Syntax
  6593. ------
  6594.      #include <string.h>
  6595.      
  6596.      char * strdup (const char *source);
  6597. Description
  6598. -----------
  6599. Returns a newly allocated area of memory that contains a duplicate of
  6600. the string pointed to by SOURCE.  The memory returned by this call must
  6601. be freed by the caller.
  6602. Return Value
  6603. ------------
  6604. Returns the newly allocated string, or NULL if there is no more memory.
  6605. Example
  6606. -------
  6607.      char *foo()
  6608.      {
  6609.        return strdup("hello");
  6610.      }
  6611. File: libcref,  Node: strerror,  Next: strftime,  Prev: strdup,  Up: Alphabetical List
  6612. `strerror'
  6613. ==========
  6614. Syntax
  6615. ------
  6616.      #include <string.h>
  6617.      
  6618.      char *strerror(int error);
  6619. Description
  6620. -----------
  6621. This function returns a string that describes the ERROR.
  6622. Return Value
  6623. ------------
  6624. A pointer to a static string that should not be modified or free'd.
  6625. Example
  6626. -------
  6627.      if (f=fopen("foo", "r") == 0)
  6628.        printf("Error! %s: %s\n", "foo", strerror(errno));
  6629. File: libcref,  Node: strftime,  Next: stricmp,  Prev: strerror,  Up: Alphabetical List
  6630. `strftime'
  6631. ==========
  6632. Syntax
  6633. ------
  6634.      #include <time.h>
  6635.      
  6636.      size_t strftime(char *buf, size_t n, const char *format, const struct tm *time);
  6637. Description
  6638. -----------
  6639. This function formats the given TIME according to the given FORMAT and
  6640. stores it in BUF, not exceeding N bytes.
  6641. The format string is like `printf' in that any character other than `%'
  6642. is added to the output string, and for each character following a `%' a
  6643. pattern is added to the string as follows, with the examples as if the
  6644. time was Friday, October 1, 1993, at 03:30:34 PM EDT:
  6645.      The full weekday name (`Friday')
  6646.      The abbreviated weekday name (`Fri')
  6647.      The full month name (`October')
  6648.      The abbreviated month name (`Oct')
  6649.      Short for `%a %b %e %H:%M:%S %Y' (`Fri Oct  1 15:30:34 1993')
  6650.      Short for `%m/%d/%y %H:%M:%S' (`10/01/93 15:30:34')
  6651.      The day of the month, blank padded to two characters (` 2')
  6652.      Short for `%m/%d/%y' (`10/01/93')
  6653.      The day of the month, zero padded to two characters (`02')
  6654.      The hour (0-24), zero padded to two characters (`15')
  6655.      The hour (1-12), zero padded to two characters (`03')
  6656.      The julien day, zero padded to three characters (`275')
  6657.      The hour (0-24), space padded to two characters (`15')
  6658.      The hour (1-12), space padded to two characters(` 3')
  6659.      The minutes, zero padded to two characters (`30')
  6660.      The month (1-12), zero padded to two characters (`10')
  6661.      A newline (`\n')
  6662.      AM or PM (`PM')
  6663.      Short for `%H:%M' (`15:30')
  6664.      Short for `%I:%M:%S %p' (`03:30:35 PM')
  6665.      The seconds, zero padded to two characters (`35')
  6666.      Short for `%H:%M:%S' (`15:30:35')
  6667.      A tab (`\t')
  6668.      The week of the year, with the first week defined by the first
  6669.      Sunday of the year, zero padded to two characters (`39')
  6670.      The week of the year, with the first week defined by the first
  6671.      Monday of the year, zero padded to two characters (`39')
  6672.      The day of the week (0-6) (`5')
  6673.      Short for `%m/%d/%y' (`10/01/93')
  6674.      The year (00-99) of the century (`93')
  6675.      The year, zero padded to four digits (`1993')
  6676.      The timezone abbreviation (`EDT')
  6677.      A percent symbol (`%')
  6678. Return Value
  6679. ------------
  6680. The number of characters stored.
  6681. Example
  6682. -------
  6683.      struct tm t;
  6684.      char buf[100];
  6685.      strftime(buf, 100, "%B %d, %Y", &t);
  6686. File: libcref,  Node: stricmp,  Next: strlen,  Prev: strftime,  Up: Alphabetical List
  6687. `stricmp'
  6688. =========
  6689. Syntax
  6690. ------
  6691.      #include <string.h>
  6692.      
  6693.      int stricmp(const char *s1, const char *s2);
  6694. Description
  6695. -----------
  6696. This function compares the two strings, disregarding case.
  6697. Return Value
  6698. ------------
  6699. Zero if they're the same, nonzero if different, the sign indicates
  6700. "order".
  6701. Example
  6702. -------
  6703.      if (stricmp(arg, "-i") == 0)
  6704.        do_include();
  6705. File: libcref,  Node: strlen,  Next: strlwr,  Prev: stricmp,  Up: Alphabetical List
  6706. `strlen'
  6707. ========
  6708. Syntax
  6709. ------
  6710.      #include <string.h>
  6711.      
  6712.      size_t strlen(const char *string);
  6713. Description
  6714. -----------
  6715. This function returns the number of characters in STRING.
  6716. Return Value
  6717. ------------
  6718. The length of the string.
  6719. Example
  6720. -------
  6721.      if (strlen(fname) > PATH_MAX)
  6722.        invalid_file(fname);
  6723. File: libcref,  Node: strlwr,  Next: strncasecmp,  Prev: strlen,  Up: Alphabetical List
  6724. `strlwr'
  6725. ========
  6726. Syntax
  6727. ------
  6728.      #include <string.h>
  6729.      
  6730.      char *strlwr(char *string);
  6731. Description
  6732. -----------
  6733. This function replaces all upper case letters in STRING with lower case
  6734. letters.
  6735. Return Value
  6736. ------------
  6737. The string.
  6738. Example
  6739. -------
  6740.      char buf[100] = "Hello";
  6741.      strlwr(buf);
  6742. File: libcref,  Node: strncasecmp,  Next: strncat,  Prev: strlwr,  Up: Alphabetical List
  6743. `strncasecmp'
  6744. =============
  6745. Syntax
  6746. ------
  6747.      #include <string.h>
  6748.      
  6749.      int strncasecmp(const char *s1, const char *s2, size_t max);
  6750. Description
  6751. -----------
  6752. This function compares S1 and S2, ignoring case, up to a maximum of MAX
  6753. characters.
  6754. Return Value
  6755. ------------
  6756. Zero if the strings are equal, a positive number if S1 comes after S2
  6757. in the ASCII collating sequense, else a negative number.
  6758. Example
  6759. -------
  6760.      if (strncasecmp(foo, "-i", 2) == 0)
  6761.        do_include();
  6762. File: libcref,  Node: strncat,  Next: strncmp,  Prev: strncasecmp,  Up: Alphabetical List
  6763. `strncat'
  6764. =========
  6765. Syntax
  6766. ------
  6767.      #include <string.h>
  6768.      
  6769.      char *strncat(char *s1, const char *s2, size_t max);
  6770. Description
  6771. -----------
  6772. This function concatenates up to MAX characters of S2 to the end of S1.
  6773. Return Value
  6774. ------------
  6775. Example
  6776. -------
  6777.      strncat(fname, extension, 4);
  6778. File: libcref,  Node: strncmp,  Next: strncpy,  Prev: strncat,  Up: Alphabetical List
  6779. `strncmp'
  6780. =========
  6781. Syntax
  6782. ------
  6783.      #include <string.h>
  6784.      
  6785.      int strncmp(const char *s1, const char *s2, size_t max);
  6786. Description
  6787. -----------
  6788. This function compares upto MAX characters of S1 and S2.
  6789. Return Value
  6790. ------------
  6791. Zero if the strings are equal, a positive number if S1 comes after S2
  6792. in the ASCII collating sequense, else a negative number.
  6793. Example
  6794. -------
  6795.      if (strncmp(arg, "-i", 2) == 0)
  6796.        do_include();
  6797. File: libcref,  Node: strncpy,  Next: strnicmp,  Prev: strncmp,  Up: Alphabetical List
  6798. `strncpy'
  6799. =========
  6800. Syntax
  6801. ------
  6802.      #include <string.h>
  6803.      
  6804.      char *strcpy(char *s1, const char *s2, size_t max);
  6805. Description
  6806. -----------
  6807. This function copies up to MAX characters of S2 into S1.
  6808. Return Value
  6809. ------------
  6810. Example
  6811. -------
  6812.      char buf[100];
  6813.      strcpy(buf, arg, 99);
  6814. File: libcref,  Node: strnicmp,  Next: strpbrk,  Prev: strncpy,  Up: Alphabetical List
  6815. `strnicmp'
  6816. ==========
  6817. Syntax
  6818. ------
  6819.      #include <string.h>
  6820.      
  6821.      int strnicmp(const char *s1, const char *s2, size_t max);
  6822. Description
  6823. -----------
  6824. This function compares S1 and S2, ignoring case, up to a maximum of MAX
  6825. characters.
  6826. Return Value
  6827. ------------
  6828. Zero if the strings are equal, a positive number if S1 comes after S2
  6829. in the ASCII collating sequense, else a negative number.
  6830. Example
  6831. -------
  6832.      if (strnicmp(foo, "-i", 2) == 0)
  6833.        do_include();
  6834. File: libcref,  Node: strpbrk,  Next: strrchr,  Prev: strnicmp,  Up: Alphabetical List
  6835. `strpbrk'
  6836. =========
  6837. Syntax
  6838. ------
  6839.      #include <string.h>
  6840.      
  6841.      char *strpbrk(const char *s1, const char *set);
  6842. Description
  6843. -----------
  6844. This function finds the first character in S1 that matches any
  6845. character in SET.
  6846. Return Value
  6847. ------------
  6848. A pointer to the first match, or `NULL' if none are found.
  6849. Example
  6850. -------
  6851.      if (strpbrk(command, "<>|"))
  6852.        do_redirection();
  6853. File: libcref,  Node: strrchr,  Next: strsep,  Prev: strpbrk,  Up: Alphabetical List
  6854. `strrchr'
  6855. =========
  6856. Syntax
  6857. ------
  6858.      #include <string.h>
  6859.      
  6860.      char *strrchr(const char *s1, int c);
  6861. Description
  6862. -----------
  6863. This function finds the last occurrence of `c' in `s1'.
  6864. Return Value
  6865. ------------
  6866. A pointer to the last match, or `NULL' if the character isn't in the
  6867. string.
  6868. Example
  6869. -------
  6870.      char *last_slash = strrchr(filename, '/');
  6871. File: libcref,  Node: strsep,  Next: strspn,  Prev: strrchr,  Up: Alphabetical List
  6872. `strsep'
  6873. ========
  6874. Syntax
  6875. ------
  6876.      #include <string.h>
  6877.      
  6878.      char *strsep(char **stringp, char *delim);
  6879. Description
  6880. -----------
  6881. This function retrieves the next token from the given string, where
  6882. STRINGP points to a variable holding, initially, the start of the
  6883. string.  Tokens are delimited by a character from DELIM.  Each time the
  6884. function is called, it returns a pointer to the next token, and sets
  6885. *STRINGP to the next spot to check, or `NULL'.
  6886. Return Value
  6887. ------------
  6888. The next token, or NULL.
  6889. Example
  6890. -------
  6891.      main()
  6892.      {
  6893.        char *buf = "Hello  there,stranger";
  6894.        char **bp = &buf;
  6895.        char *tok;
  6896.        while (tok = strsep(bp, " ,"))
  6897.          printf("tok = `%s'\n", tok);
  6898.      }
  6899.      
  6900.      tok = `Hello'
  6901.      tok = `'
  6902.      tok = `there'
  6903.      tok = `stranger'
  6904. File: libcref,  Node: strspn,  Next: strstr,  Prev: strsep,  Up: Alphabetical List
  6905. `strspn'
  6906. ========
  6907. Syntax
  6908. ------
  6909.      #include <string.h>
  6910.      
  6911.      size_t strspn(const char *s1, const char *set);
  6912. Description
  6913. -----------
  6914. This function finds the first character in S1 that does not match any
  6915. character in SET.  Note that the `NULL' bytes at the end of S1 counts,
  6916. so you'll at least get a pointer to the end of the string if nothing
  6917. else.
  6918. Return Value
  6919. ------------
  6920. The index of the found character.
  6921. Example
  6922. -------
  6923.      int i = strcspn(entry, " \t\b");
  6924.      if (entry[i])
  6925.        do_something();
  6926. File: libcref,  Node: strstr,  Next: strtod,  Prev: strspn,  Up: Alphabetical List
  6927. `strstr'
  6928. ========
  6929. Syntax
  6930. ------
  6931.      #include <string.h>
  6932.      
  6933.      char *strstr(const char *s1, const char *s2);
  6934. Description
  6935. -----------
  6936. This function finds the first occurrence of S2 in S1.
  6937. Return Value
  6938. ------------
  6939. A pointer within S1, or `NULL' if S2 wasn't found.
  6940. Example
  6941. -------
  6942.      if (strstr(command, ".exe"))
  6943.        do_exe();
  6944. File: libcref,  Node: strtod,  Next: strtok,  Prev: strstr,  Up: Alphabetical List
  6945. `strtod'
  6946. ========
  6947. Syntax
  6948. ------
  6949.      #include <stdlib.h>
  6950.      
  6951.      double strtod(const char *s, char **endp);
  6952. Description
  6953. -----------
  6954. This function converts as many characters of S that look like a
  6955. floating point number into one, and sets *ENDP to point to the first
  6956. unused character.
  6957. Return Value
  6958. ------------
  6959. The value the string represented.
  6960. Example
  6961. -------
  6962.      char *buf = "123ret";
  6963.      char *bp;
  6964.      double x = strtod(buf, &bp);
  6965. File: libcref,  Node: strtok,  Next: strtol,  Prev: strtod,  Up: Alphabetical List
  6966. `strtok'
  6967. ========
  6968. Syntax
  6969. ------
  6970.      #include <string.h>
  6971.      
  6972.      char *strtok(char *s1, const char *s2);
  6973. Description
  6974. -----------
  6975. This function retrieves tokens from S1 which are delimited by
  6976. characters from S2.
  6977. To initiate the search, pass the string to be searched as S1.  For the
  6978. remaining tokens, pass `NULL' instead.
  6979. Return Value
  6980. ------------
  6981. A pointer to the token, or `NULL' if no more are found.
  6982. Example
  6983. -------
  6984.      main()
  6985.      {
  6986.        char *buf = "Hello there, stranger";
  6987.        char *tok;
  6988.        for (tok = strtok(buf, " ,");
  6989.             tok;
  6990.             tok=strtok(0, " ,"))
  6991.          printf("tok = `%s'\n", tok);
  6992.      }
  6993.      
  6994.      tok = `Hello'
  6995.      tok = `there'
  6996.      tok = `stranger'
  6997. File: libcref,  Node: strtol,  Next: strtoul,  Prev: strtok,  Up: Alphabetical List
  6998. `strtol'
  6999. ========
  7000. Syntax
  7001. ------
  7002.      #include <stdlib.h>
  7003.      
  7004.      long strtol(const char *s, char **endp, int base);
  7005. Description
  7006. -----------
  7007. This function converts as much of S as looks like an appropriate number
  7008. into the value of that number, and sets *ENDP to point to the first
  7009. unused character.
  7010. The BASE argument indicates what base the digits (or letters) should be
  7011. treated as.  If BASE is zero, the base is determined by looking for
  7012. `0x', `0X', or `0' as the first part of the string, and sets the base
  7013. used to 16, 16, or 8 if it finds one.  The default base is 10 if none
  7014. of those prefixes are found.
  7015. Return Value
  7016. ------------
  7017. The value.
  7018. Example
  7019. -------
  7020.      printf("Enter a number: "); fflush(stdout);
  7021.      gets(buf);
  7022.      char *bp;
  7023.      printf("The value is %d\n", strtol(buf, &bp, 0));
  7024. File: libcref,  Node: strtoul,  Next: strupr,  Prev: strtol,  Up: Alphabetical List
  7025. `strtoul'
  7026. =========
  7027. Syntax
  7028. ------
  7029.      #include <stdlib.h>
  7030.      
  7031.      unsigned long strtoul(const char *s, char **endp, int base);
  7032. Description
  7033. -----------
  7034. This is just like `strtol' (*Note strtol::) except that the result is
  7035. unsigned.
  7036. Return Value
  7037. ------------
  7038. The value.
  7039. Example
  7040. -------
  7041.      printf("Enter a number: "); fflush(stdout);
  7042.      gets(buf);
  7043.      char *bp;
  7044.      printf("The value is %u\n", strtoul(buf, &bp, 0));
  7045. File: libcref,  Node: strupr,  Next: strxfrm,  Prev: strtoul,  Up: Alphabetical List
  7046. `strupr'
  7047. ========
  7048. Syntax
  7049. ------
  7050.      #include <string.h>
  7051.      
  7052.      char *strupr(char *string);
  7053. Description
  7054. -----------
  7055. This function converts all lower case characters in STRING to upper
  7056. case.
  7057. Return Value
  7058. ------------
  7059. STRING
  7060. Example
  7061. -------
  7062.      char buf[] = "Foo!";
  7063.      strupr(buf);
  7064. File: libcref,  Node: strxfrm,  Next: swab,  Prev: strupr,  Up: Alphabetical List
  7065. `strxfrm'
  7066. =========
  7067. Syntax
  7068. ------
  7069.      #include <string.h>
  7070.      
  7071.      size_t strxfrm(char *s1, const char *s2, size_t max);
  7072. Description
  7073. -----------
  7074. This copies characters from S2 to S1, which must be able to hold MAX
  7075. characters.  Each character is transformed according to the locale such
  7076. that `strcmp(s1b, s2b)' is just like `strcoll(s1, s2)' where `s1b' and
  7077. `s2b' are the transforms of `s1' and `s2'.
  7078. Return Value
  7079. ------------
  7080. The actual number of bytes required to transform S2, including the
  7081. `NULL'.
  7082. File: libcref,  Node: swab,  Next: sync,  Prev: strxfrm,  Up: Alphabetical List
  7083. `swab'
  7084. ======
  7085. Syntax
  7086. ------
  7087.      #include <osfcn.h>
  7088.      
  7089.      void swab(void *from, void *to, int bytes);
  7090. Description
  7091. -----------
  7092. This function swaps each pair of bytes in FROM as they're copied to TO.
  7093. Return Value
  7094. ------------
  7095. None.
  7096. Example
  7097. -------
  7098.      swab(packet, header, sizeof(header);
  7099. File: libcref,  Node: sync,  Next: sys_errlist,  Prev: swab,  Up: Alphabetical List
  7100. `sync'
  7101. ======
  7102. Description
  7103. -----------
  7104. This function is provided only to assist in porting from Unix.  It
  7105. always returns an error condition.
  7106. File: libcref,  Node: sys_errlist,  Next: sys_nerr,  Prev: sync,  Up: Alphabetical List
  7107. `sys_errlist'
  7108. =============
  7109. Syntax
  7110. ------
  7111.      #include <errno.h>
  7112.      
  7113.      extern char *sys_errlist[];
  7114. Description
  7115. -----------
  7116. This array contains error messages, indexed by `errno', that describe
  7117. the errors.
  7118. Example
  7119. -------
  7120.      printf("Error: %s\n", sys_errlist[errno]);
  7121. File: libcref,  Node: sys_nerr,  Next: sysconf,  Prev: sys_errlist,  Up: Alphabetical List
  7122. `sys_nerr'
  7123. ==========
  7124. Syntax
  7125. ------
  7126.      #include <errno.h>
  7127.      
  7128.      extern int sys_nerr;
  7129. Description
  7130. -----------
  7131. This variable gives the number of error messages in `sys_errlist'
  7132. (*Note sys_errlist::).
  7133. Example
  7134. -------
  7135.      if (errno < sys_nerr)
  7136.        printf("Error: %s\n", sys_errlist[errno]);
  7137. File: libcref,  Node: sysconf,  Next: system,  Prev: sys_nerr,  Up: Alphabetical List
  7138. `sysconf'
  7139. =========
  7140. Syntax
  7141. ------
  7142.      #include <unistd.h>
  7143.      
  7144.      long sysconf(int which);
  7145. Description
  7146. -----------
  7147. This function returns various system configuration values, based on
  7148. WHICH:
  7149.      case _SC_ARG_MAX:           return ARG_MAX;
  7150.      case _SC_CHILD_MAX:         return CHILD_MAX;
  7151.      case _SC_CLK_TCK:           return CLK_TCK;
  7152.      case _SC_NGROUPS_MAX:       return NGROUPS_MAX;
  7153.      case _SC_OPEN_MAX:          return OPEN_MAX;
  7154.      case _SC_JOB_CONTROL:       return -1;
  7155.      case _SC_SAVED_IDS:         return -1;
  7156.      case _SC_VERSION:           return _POSIX_VERSION;
  7157.      case _SC_XOPEN_VERSION:     return _XOPEN_VERSION;
  7158.      case _SC_PASS_MAX:          return PASS_MAX;
  7159.      case _SC_STREAM_MAX:        return _POSIX_STREAM_MAX;
  7160.      case _SC_TZNAME_MAX:        return TZNAME_MAX;
  7161.      case _SC_BC_BASE_MAX:       return BC_BASE_MAX;
  7162.      case _SC_BC_DIM_MAX:        return BC_DIM_MAX;
  7163.      case _SC_BC_SCALE_MAX:      return BC_SCALE_MAX;
  7164.      case _SC_COLL_ELEM_MAX:     return COLL_ELEM_MAX;
  7165.      case _SC_EXPR_NEST_MAX:     return EXPR_NEST_MAX;
  7166.      case _SC_LINE_MAX:          return LINE_MAX;
  7167.      case _SC_PASTE_FILES_MAX:   return PASTE_FILES_MAX;
  7168.      case _SC_RE_DUP_MAX:        return RE_DUP_MAX;
  7169.      case _SC_SED_PATTERN_MAX:   return SED_PATTERN_MAX;
  7170.      case _SC_SENDTO_MAX:        return SENDTO_MAX;
  7171.      case _SC_SORT_LINE_MAX:     return SORT_LINE_MAX;
  7172.      case _SC_2_VERSION:         return _POSIX2_VERSION;
  7173.      case _SC_2_C_BIND:          return _POSIX2_C_BIND;
  7174.      case _SC_2_C_DEV:           return _POSIX2_C_DEV;
  7175.      case _SC_2_FORT_DEV:        return _POSIX2_FORT_DEV;
  7176.      case _SC_2_SW_DEV:          return _POSIX2_SW_DEV;
  7177.      case _SC_CLOCKS_PER_SEC:    return CLOCKS_PER_SEC;
  7178.      case _SC_AES_OS_VERSION:    return -1;
  7179.      case _SC_PAGE_SIZE:         return 4096;
  7180.      case _SC_ATEXIT_MAX:        return ATEXIT_MAX;
  7181. Return Value
  7182. ------------
  7183. The value.
  7184. File: libcref,  Node: system,  Next: tell,  Prev: sysconf,  Up: Alphabetical List
  7185. `system'
  7186. ========
  7187. Syntax
  7188. ------
  7189.      #include <stdlib.h>
  7190.      
  7191.      int system(const char *cmd);
  7192. Description
  7193. -----------
  7194. This function runs the specified command.
  7195. Go32 automatically detects if redirection is requested and will attempt
  7196. to run the program directly if not, to work around the fact that
  7197. command.com does not return the exit code of the child process.  If it
  7198. can't run it directly, command.com is used to run the child.
  7199. Return Value
  7200. ------------
  7201. The return value of the child process, unless command.com doesn't return
  7202. Example
  7203. -------
  7204.      system("cc1plus.exe @cc123456.gp");
  7205. File: libcref,  Node: tell,  Next: telldir,  Prev: system,  Up: Alphabetical List
  7206. `tell'
  7207. ======
  7208. Syntax
  7209. ------
  7210.      long tell(int file);
  7211. Description
  7212. -----------
  7213. This function returns the location of the file pointer for FILE.
  7214. Return Value
  7215. ------------
  7216. The file pointer, or -1 on error.
  7217. Example
  7218. -------
  7219.      long q = tell(fd);
  7220. File: libcref,  Node: telldir,  Next: tempnam,  Prev: tell,  Up: Alphabetical List
  7221. `telldir'
  7222. =========
  7223. Syntax
  7224. ------
  7225.      #include <dirent.h>
  7226.      
  7227.      long telldir(DIR *dir);
  7228. Description
  7229. -----------
  7230. This function returns a value which indicates the position of the
  7231. pointer in the given directory.  This value is only useful as an
  7232. argument to `seekdir' (*Note seekdir::).
  7233. Return Value
  7234. ------------
  7235. The directory pointer.
  7236. Example
  7237. -------
  7238.      DIR *dir;
  7239.      long q = telldir(dir);
  7240.      do_something();
  7241.      seekdir(dir, q);
  7242. File: libcref,  Node: tempnam,  Next: time,  Prev: telldir,  Up: Alphabetical List
  7243. `tempnam'
  7244. =========
  7245. Syntax
  7246. ------
  7247.      #include <stdio.h>
  7248.      
  7249.      char *tempnam(const char *dir, const char *prefix);
  7250. Description
  7251. -----------
  7252. This function returns a temporary file name in a buffer allocated by
  7253. `malloc'.  The locations and filenames searched for temporary space are
  7254. as follows:
  7255.      getenv("TMPDIR")/PREFIX??????
  7256.      DIR/PREFIX??????
  7257.      `P_tmpdir'/PREFIX??????
  7258.      /tmp/PREFIX??????
  7259. Return Value
  7260. ------------
  7261. A pointer to the file name, or NULL if error.
  7262. Example
  7263. -------
  7264.      char *fn = tempnam(".", "dj");
  7265.      free(fn);
  7266. File: libcref,  Node: time,  Next: timezone,  Prev: tempnam,  Up: Alphabetical List
  7267. `time'
  7268. ======
  7269. Syntax
  7270. ------
  7271.      #include <time.h>
  7272.      
  7273.      time_t time(time_t *t);
  7274. Description
  7275. -----------
  7276. If T is not `NULL', the current time is stored in `*t'.
  7277. Return Value
  7278. ------------
  7279. The current time is returned.
  7280. Example
  7281. -------
  7282.      printf("Time is %d\n", time(0));
  7283. File: libcref,  Node: timezone,  Next: tmpfile,  Prev: time,  Up: Alphabetical List
  7284. `timezone'
  7285. ==========
  7286. Syntax
  7287. ------
  7288.      #include <time.h>
  7289.      
  7290.      char *timezone(int minutes, int daylight);
  7291. Description
  7292. -----------
  7293. Given the number of minutes west of GMT and whether or not daylight
  7294. savings time is in affect, returns the name of the timezone.
  7295. If the environment variable TZNAME is set, it should be like `EST,EDT',
  7296. and the name of the timezone will come from that.
  7297. Return Value
  7298. ------------
  7299. A pointer to the timezone or `NULL' if invalid.
  7300. Example
  7301. -------
  7302.      printf("EST ? %s\n", timezone(5*60, 0));
  7303. File: libcref,  Node: tmpfile,  Next: tmpnam,  Prev: timezone,  Up: Alphabetical List
  7304. `tmpfile'
  7305. =========
  7306. Syntax
  7307. ------
  7308.      #include <stdio.h>
  7309.      
  7310.      FILE *tmpfile(void);
  7311. Description
  7312. -----------
  7313. This function opens a temporary file.  It will automatically be removed
  7314. when the program exits.
  7315. Return Value
  7316. ------------
  7317. A newly opened file.
  7318. Example
  7319. -------
  7320.      FILE *tmp = tmpfile();
  7321. File: libcref,  Node: tmpnam,  Next: tolower,  Prev: tmpfile,  Up: Alphabetical List
  7322. `tmpnam'
  7323. ========
  7324. Syntax
  7325. ------
  7326.      #include <stdio.h>
  7327.      
  7328.      char *tmpnam(char *s);
  7329. Description
  7330. -----------
  7331. If S is NULL, a buffer is allocated, else S is used to hold the name of
  7332. a unique file.
  7333. Return Value
  7334. ------------
  7335. A pointer to the new file name.
  7336. Example
  7337. -------
  7338.      char buf[PATH_MAX];
  7339.      char *s = tmpname(buf);
  7340. File: libcref,  Node: tolower,  Next: toupper,  Prev: tmpnam,  Up: Alphabetical List
  7341. `tolower'
  7342. =========
  7343. Syntax
  7344. ------
  7345.      #include <ctype.h>
  7346.      
  7347.      int tolower(int c);
  7348. Description
  7349. -----------
  7350. This function returns C, converting it to lower case if it is upper
  7351. case.  *Note toupper::
  7352. Return Value
  7353. ------------
  7354. The upper case letter.
  7355. Example
  7356. -------
  7357.      for (i=0; buf[i]; i++)
  7358.        buf[i] = tolower(buf[i]);
  7359. File: libcref,  Node: toupper,  Next: truncate,  Prev: tolower,  Up: Alphabetical List
  7360. `toupper'
  7361. =========
  7362. Syntax
  7363. ------
  7364.      #include <ctype.h>
  7365.      
  7366.      int toupper(int c);
  7367. Description
  7368. -----------
  7369. This function returns C, converting it to upper case if it is lower
  7370. case. *Note tolower::
  7371. Return Value
  7372. ------------
  7373. The upper case letter.
  7374. Example
  7375. -------
  7376.      for (i=0; buf[i]; i++)
  7377.        buf[i] = toupper(buf[i]);
  7378. File: libcref,  Node: truncate,  Next: ttyname,  Prev: toupper,  Up: Alphabetical List
  7379. `truncate'
  7380. ==========
  7381. Syntax
  7382. ------
  7383.      #include <osfcn.h>
  7384.      
  7385.      int truncate(const char *file, unsigned long size);
  7386. Description
  7387. -----------
  7388. This function truncates FILE to SIZE bytes.
  7389. Return Value
  7390. ------------
  7391. Zero on success, nonzero on failure.
  7392. Example
  7393. -------
  7394.      ftruncate("/tmp/data.txt", 400);
  7395. File: libcref,  Node: ttyname,  Next: tzname,  Prev: truncate,  Up: Alphabetical List
  7396. `ttyname'
  7397. =========
  7398. Syntax
  7399. ------
  7400.      #include <osfcn.h>
  7401.      
  7402.      char *ttyname(int file);
  7403. Description
  7404. -----------
  7405. Gives the name of the terminal associated with FILE.
  7406. Return Value
  7407. ------------
  7408. Returns "/dev/con" if FILE is a device, else `NULL'.
  7409. Example
  7410. -------
  7411.      char *tty = ttyname(0);
  7412. File: libcref,  Node: tzname,  Next: tzset,  Prev: ttyname,  Up: Alphabetical List
  7413. `tzname'
  7414. ========
  7415. Syntax
  7416. ------
  7417.      extern char *tzname[2]
  7418. Description
  7419. -----------
  7420. This array holds the names of standard and daylight savings timezones
  7421. for the local area.  You must call `tzset' to initialize these.
  7422. File: libcref,  Node: tzset,  Next: tzsetwall,  Prev: tzname,  Up: Alphabetical List
  7423. `tzset'
  7424. =======
  7425. Syntax
  7426. ------
  7427.      #include <time.h>
  7428.      
  7429.      void tzset(void);
  7430. Description
  7431. -----------
  7432. This function initializes the timezone information.
  7433. Return Value
  7434. ------------
  7435. None.
  7436. File: libcref,  Node: tzsetwall,  Next: _tztab,  Prev: tzset,  Up: Alphabetical List
  7437. `tzsetwall'
  7438. ===========
  7439. Syntax
  7440. ------
  7441.      #include <time.h>
  7442.      
  7443.      void tzsetwall(void)
  7444. Description
  7445. -----------
  7446. This function initializes the system to "wall clock" time.
  7447. Return Value
  7448. ------------
  7449. None.
  7450. File: libcref,  Node: _tztab,  Next: umask,  Prev: tzsetwall,  Up: Alphabetical List
  7451. `_tztab'
  7452. ========
  7453. Description
  7454. -----------
  7455. This is an internal variable used by the `tz' functions.
  7456. File: libcref,  Node: umask,  Next: ungetc,  Prev: _tztab,  Up: Alphabetical List
  7457. `umask'
  7458. =======
  7459. Description
  7460. -----------
  7461. This is an internal function used by gcc to help perform certain
  7462. operations.
  7463. File: libcref,  Node: ungetc,  Next: unlink,  Prev: umask,  Up: Alphabetical List
  7464. `ungetc'
  7465. ========
  7466. Syntax
  7467. ------
  7468.      #include <stdio.h>
  7469.      
  7470.      int ungetc(int c, FILE *file);
  7471. Description
  7472. -----------
  7473. This function pushes C back into the FILE.  You can only push back one
  7474. character at a time.
  7475. Return Value
  7476. ------------
  7477. The pushed-back character, or `EOF' on error.
  7478. Example
  7479. -------
  7480.      int q;
  7481.      while (q = getc(stdin) != 'q');
  7482.      ungetc(q);
  7483. File: libcref,  Node: unlink,  Next: unlock,  Prev: ungetc,  Up: Alphabetical List
  7484. `unlink'
  7485. ========
  7486. Syntax
  7487. ------
  7488.      #include <osfcn.h>
  7489.      
  7490.      int unlink(const char *file);
  7491. Description
  7492. -----------
  7493. This function removes a file from the file system.
  7494. Return Value
  7495. ------------
  7496. Zero on success, nonzero on failure.
  7497. Example
  7498. -------
  7499.      unlink("data.txt");
  7500. File: libcref,  Node: unlock,  Next: unsetenv,  Prev: unlink,  Up: Alphabetical List
  7501. `unlock'
  7502. ========
  7503. Syntax
  7504. ------
  7505.      #include <io.h>
  7506.      
  7507.      int unlock(int fd, long offset, long length);
  7508. Description
  7509. -----------
  7510. Unlocks a region previously locked by `lock'.
  7511. *Note lock::.
  7512. Return Value
  7513. ------------
  7514. Zero if successful, nonzero if not.
  7515. File: libcref,  Node: unsetenv,  Next: usleep,  Prev: unlock,  Up: Alphabetical List
  7516. `unsetenv'
  7517. ==========
  7518. Syntax
  7519. ------
  7520.      #include <stdlib.h>
  7521.      
  7522.      void unsetenv(const char *name);
  7523. Description
  7524. -----------
  7525. This function removes the given environment variable from the
  7526. environment.
  7527. Return Value
  7528. ------------
  7529. None.
  7530. Example
  7531. -------
  7532.      unsetenv("TERM");
  7533. File: libcref,  Node: usleep,  Next: utime,  Prev: unsetenv,  Up: Alphabetical List
  7534. `usleep'
  7535. ========
  7536. Syntax
  7537. ------
  7538.      #include <osfcn.h>
  7539.      
  7540.      unsigned usleep(unsigned usec);
  7541. Description
  7542. -----------
  7543. This function pauses the program for USEC microseconds.
  7544. Return Value
  7545. ------------
  7546. The number of unsleept microseconds (i.e. zero).
  7547. Example
  7548. -------
  7549.      usleep(500000);
  7550. File: libcref,  Node: utime,  Next: utimes,  Prev: usleep,  Up: Alphabetical List
  7551. `utime'
  7552. =======
  7553. Syntax
  7554. ------
  7555.      #include <utime.h>
  7556.      
  7557.      itn utime(const char *file, const struct utimbuf *time);
  7558. Description
  7559. -----------
  7560. This function sets the modification timestamp on the FILE.  The new
  7561. time is stored in this structure:
  7562.      struct utimbuf
  7563.      {
  7564.          time_t  actime;  /* access time (unused) */
  7565.          time_t  modtime; /* modification time */
  7566.      };
  7567. Return Value
  7568. ------------
  7569. Zero for success, nonzero for failure.
  7570. Example
  7571. -------
  7572.      struct utimbuf t;
  7573.      t.modtime = time(0);
  7574.      utime("data.txt", &t);
  7575. File: libcref,  Node: utimes,  Next: valloc,  Prev: utime,  Up: Alphabetical List
  7576. `utimes'
  7577. ========
  7578. Syntax
  7579. ------
  7580.      int utimes(const char *file, struct timevar tvp[2]);
  7581. Description
  7582. -----------
  7583. This function does nothing.  It is provided to assist in porting Unix
  7584. programs.
  7585. Return Value
  7586. ------------
  7587. Zero for success, nonzero for failure.
  7588. File: libcref,  Node: valloc,  Next: vfork,  Prev: utimes,  Up: Alphabetical List
  7589. `valloc'
  7590. ========
  7591. Syntax
  7592. ------
  7593.      #include <stdlib.h>
  7594.      
  7595.      void *valloc(unsigned size);
  7596. Description
  7597. -----------
  7598. This function is just like `malloc' (*Note malloc::) except that the
  7599. returned pointer is always aligned to a CPU page boundary.  This
  7600. alignment is rarely useful in djgpp.
  7601. Return Value
  7602. ------------
  7603. A pointer to a newly allocated block of memory.
  7604. Example
  7605. -------
  7606.      char *page = valloc(getpagesize());
  7607. File: libcref,  Node: vfork,  Next: vfprintf,  Prev: valloc,  Up: Alphabetical List
  7608. `vfork'
  7609. =======
  7610. Description
  7611. -----------
  7612. This function is provided to assist in porting Unix programs only.  It
  7613. always fails.
  7614. Return Value
  7615. ------------
  7616. File: libcref,  Node: vfprintf,  Next: vprintf,  Prev: vfork,  Up: Alphabetical List
  7617. `vfprintf'
  7618. ==========
  7619. Syntax
  7620. ------
  7621.      #include <stdio.h>
  7622.      #include <stdarg.h>
  7623.      
  7624.      int vfprintf(FILE *file, const char *format, va_list arguments);
  7625. Description
  7626. -----------
  7627. Sends formatted output from the ARGUMENTS to the FILE.  *Note printf::
  7628. Return Value
  7629. ------------
  7630. The number of characters written.
  7631. File: libcref,  Node: vprintf,  Next: vsprintf,  Prev: vfprintf,  Up: Alphabetical List
  7632. `vprintf'
  7633. =========
  7634. Syntax
  7635. ------
  7636.      #include <stdio.h>
  7637.      #include <stdarg.h>
  7638.      
  7639.      int vprintf(const char *format, va_list arguments);
  7640. Description
  7641. -----------
  7642. Sends formatted output from the ARGUMENTS to `stdout'.  *Note printf::
  7643. Return Value
  7644. ------------
  7645. The number of characters written.
  7646. File: libcref,  Node: vsprintf,  Next: wait,  Prev: vprintf,  Up: Alphabetical List
  7647. `vsprintf'
  7648. ==========
  7649. Syntax
  7650. ------
  7651.      #include <stdio.h>
  7652.      #include <stdarg.h>
  7653.      
  7654.      int vsprintf(char *buffer, const char *format, va_list arguments);
  7655. Description
  7656. -----------
  7657. Sends formatted output from the ARGUMENTS to the BUFFER.  *Note printf::
  7658. Return Value
  7659. ------------
  7660. The number of characters written.
  7661. File: libcref,  Node: wait,  Next: write,  Prev: vsprintf,  Up: Alphabetical List
  7662. `wait'
  7663. ======
  7664. Description
  7665. -----------
  7666. This function is provided only to assist in porting from Unix.  It
  7667. always returns an error condition.
  7668. File: libcref,  Node: write,  Next: writecr,  Prev: wait,  Up: Alphabetical List
  7669. `write'
  7670. =======
  7671. Syntax
  7672. ------
  7673.      #include <osfcn.h>
  7674.      
  7675.      int write(int file, const void *buffer, unsigned count);
  7676. Description
  7677. -----------
  7678. This function writes COUNT bytes from BUFFER to FILE.  It returns the
  7679. number of bytes actually written.  It will return zero at end-of-file,
  7680. and may return less than COUNT even under valid conditions.
  7681. Note that if FILE is a text file, `write' may write more bytes than it
  7682. reports.
  7683. Return Value
  7684. ------------
  7685. The number of bytes written, zero at EOF, or -1 on error.
  7686. Example
  7687. -------
  7688.      write(fd, "hello", 5);
  7689. File: libcref,  Node: writecr,  Next: writev,  Prev: write,  Up: Alphabetical List
  7690. `writecr'
  7691. =========
  7692. Syntax
  7693. ------
  7694.      int write(int file, const void *buffer, unsigned count);
  7695. Description
  7696. -----------
  7697. This is just like `write' (*Note write::) except that the Ctrl-M
  7698. characters are inserted before each Ctrl-J character to convert from
  7699. Unix-style text lines to DOS-style text lines when writing to a binary
  7700. file.
  7701. Return Value
  7702. ------------
  7703. The number of bytes written, zero at EOF, or -1 on error.
  7704. Example
  7705. -------
  7706.      writecr(fd, "hello\n", 6);
  7707. File: libcref,  Node: writev,  Next: xmalloc,  Prev: writecr,  Up: Alphabetical List
  7708. `writev'
  7709. ========
  7710. Syntax
  7711. ------
  7712.      #include <sys/uio.h>
  7713.      
  7714.      int writev(int handle, struct iovec *iov, int count);
  7715. Description
  7716. -----------
  7717. This is just like `readv' (*Note readv::), except that it writes
  7718. instead of reading.
  7719. Return Value
  7720. ------------
  7721. The number of bytes written.
  7722. File: libcref,  Node: xmalloc,  Next: xrealloc,  Prev: writev,  Up: Alphabetical List
  7723. `xmalloc'
  7724. =========
  7725. Syntax
  7726. ------
  7727.      void *xmalloc(size_t size);
  7728. Description
  7729. -----------
  7730. This function is just like `malloc' (*Note malloc::), except that if
  7731. there is no more memory, it prints an error message and exits.
  7732. Return Value
  7733. ------------
  7734. A pointer to the newly allocated memory.
  7735. Example
  7736. -------
  7737.      char *f = xmalloc(100);
  7738. File: libcref,  Node: xrealloc,  Prev: xmalloc,  Up: Alphabetical List
  7739. `xrealloc'
  7740. ==========
  7741. Syntax
  7742. ------
  7743.      void *xrealloc(void *ptr, size_t size);
  7744. Description
  7745. -----------
  7746. This function is just like `realloc' (*Note realloc::), except that if
  7747. there is no more memory, it prints an error message and exits.  It can
  7748. also properly handle PTR being `NULL'.
  7749. Return Value
  7750. ------------
  7751. A pointer to a possibly new block.
  7752. Example
  7753. -------
  7754.      char *buf;
  7755.      buf = (char *)xrealloc(buf, new_size);
  7756. File: libcref,  Node: Index,  Up: Top
  7757. * Menu:
  7758. *Note Alphabetical List::
  7759. Tag Table:
  7760. Node: Top
  7761. Node: Introduction
  7762. Node: Overview
  7763. Node: Functional Categories
  7764. Node: Alphabetical List
  7765. Node: abort
  7766. Node: abs
  7767. Node: access
  7768. Node: addmntent
  7769. 10188
  7770. Node: asctime
  7771. 10612
  7772. Node: __atexit
  7773. 11340
  7774. Node: atexit
  7775. 11574
  7776. Node: atof
  7777. 12307
  7778. Node: atoi
  7779. 12878
  7780. Node: atol
  7781. 13435
  7782. Node: bcmp
  7783. 13994
  7784. Node: _bcopy
  7785. 14599
  7786. Node: bcopy
  7787. 15248
  7788. Node: bdos
  7789. 15728
  7790. Node: bdosptr
  7791. 16171
  7792. Node: biosequip
  7793. 16620
  7794. Node: bioskey
  7795. 17957
  7796. Node: biosmemory
  7797. 18815
  7798. Node: biosprint
  7799. 19366
  7800. Node: brk
  7801. 20148
  7802. Node: bsearch
  7803. 20788
  7804. Node: bzero
  7805. 22045
  7806. Node: calloc
  7807. 22407
  7808. Node: cfree
  7809. 23056
  7810. Node: chdir
  7811. 23459
  7812. Node: chmod
  7813. 24017
  7814. Node: chown
  7815. 24623
  7816. Node: _cleanup
  7817. 24957
  7818. Node: clearerr
  7819. 25189
  7820. Node: clock
  7821. 25553
  7822. Node: close
  7823. 26077
  7824. Node: closedir
  7825. 26494
  7826. Node: creat
  7827. 26847
  7828. Node: crlf2nl
  7829. 27564
  7830. Node: ctime
  7831. 27911
  7832. Node: _ctype_
  7833. 28340
  7834. Node: delay
  7835. 28615
  7836. Node: difftime
  7837. 29053
  7838. Node: disable
  7839. 29548
  7840. Node: div
  7841. 29893
  7842. Node: _doprnt
  7843. 30466
  7844. Node: _doscan
  7845. 31104
  7846. Node: _doscan_low
  7847. 31810
  7848. Node: dosmemget
  7849. 32006
  7850. Node: dosmemput
  7851. 32877
  7852. Node: dup
  7853. 33706
  7854. Node: dup2
  7855. 34125
  7856. Node: enable
  7857. 34664
  7858. Node: endgrent
  7859. 35006
  7860. Node: endmntent
  7861. 35368
  7862. Node: endpwent
  7863. 35739
  7864. Node: errno
  7865. 36065
  7866. Node: exec*
  7867. 36447
  7868. Node: _exit
  7869. 37514
  7870. Node: exit
  7871. 37987
  7872. Node: _f_morefiles
  7873. 38527
  7874. Node: fchmod
  7875. 38734
  7876. Node: fclose
  7877. 39059
  7878. Node: fdopen
  7879. 39456
  7880. Node: feof
  7881. 40005
  7882. Node: ferror
  7883. 40439
  7884. Node: fflush
  7885. 40893
  7886. Node: ffs
  7887. 41427
  7888. Node: fgetc
  7889. 41940
  7890. Node: fgetgrent
  7891. 42382
  7892. Node: fgetpos
  7893. 42686
  7894. Node: fgetpwent
  7895. 43101
  7896. Node: fgets
  7897. 43401
  7898. Node: _filbuf
  7899. 44165
  7900. Node: fileno
  7901. 44363
  7902. Node: _findenv
  7903. 44705
  7904. Node: findfirst
  7905. 44936
  7906. Node: _findiop
  7907. 47182
  7908. Node: findnext
  7909. 47384
  7910. Node: _fixpath
  7911. 47759
  7912. Node: _flsbuf
  7913. 48504
  7914. Node: _fmode
  7915. 48705
  7916. Node: fnmatch
  7917. 49159
  7918. Node: fnmerge
  7919. 50714
  7920. Node: fnsplit
  7921. 51205
  7922. Node: fopen
  7923. 52058
  7924. Node: fork
  7925. 53632
  7926. Node: fpathconf
  7927. 53891
  7928. Node: fprintf
  7929. 54270
  7930. Node: fpurge
  7931. 54629
  7932. Node: fputc
  7933. 54964
  7934. Node: fputs
  7935. 55353
  7936. Node: fread
  7937. 55790
  7938. Node: free
  7939. 56258
  7940. Node: freopen
  7941. 56656
  7942. Node: fscanf
  7943. 57215
  7944. Node: fseek
  7945. 57636
  7946. Node: fsetpos
  7947. 58717
  7948. Node: fstat
  7949. 59137
  7950. Node: fsync
  7951. 59516
  7952. Node: ftell
  7953. 59903
  7954. Node: ftime
  7955. 60308
  7956. Node: ftruncate
  7957. 61046
  7958. Node: _fwalk
  7959. 61552
  7960. Node: fwrite
  7961. 62000
  7962. Node: _get_default_drive
  7963. 62492
  7964. Node: getc
  7965. 62896
  7966. Node: getcbrk
  7967. 63305
  7968. Node: getchar
  7969. 63640
  7970. Node: getcwd
  7971. 63942
  7972. Node: getdate
  7973. 64670
  7974. Node: getdfree
  7975. 65173
  7976. Node: getdisk
  7977. 65913
  7978. Node: getdtablesize
  7979. 66286
  7980. Node: getegid
  7981. 66737
  7982. Node: getenv
  7983. 67007
  7984. Node: geteuid
  7985. 67450
  7986. Node: getftime
  7987. 67711
  7988. Node: getgid
  7989. 68441
  7990. Node: getgrent
  7991. 68702
  7992. Node: getgrgid
  7993. 69686
  7994. Node: getgrnam
  7995. 70063
  7996. Node: getgroups
  7997. 70445
  7998. Node: getkey
  7999. 70689
  8000. Node: getlogin
  8001. 71266
  8002. Node: getlongpass
  8003. 71709
  8004. Node: getmntent
  8005. 72356
  8006. Node: getopt
  8007. 73791
  8008. Node: getpagesize
  8009. 75273
  8010. Node: getpass
  8011. 75619
  8012. Node: getpid
  8013. 76120
  8014. Node: getpwent
  8015. 76449
  8016. Node: getpwnam
  8017. 77555
  8018. Node: getpwuid
  8019. 77932
  8020. Node: getrusage
  8021. 78292
  8022. Node: gets
  8023. 79020
  8024. Node: gettime
  8025. 79605
  8026. Node: gettimeofday
  8027. 80164
  8028. Node: getuid
  8029. 80964
  8030. Node: getw
  8031. 81220
  8032. Node: getwd
  8033. 81702
  8034. Node: getxkey
  8035. 82111
  8036. Node: gmtime
  8037. 82681
  8038. Node: _go32_conventional_mem_selector
  8039. 83859
  8040. Node: Go32/DPMI Information
  8041. 84951
  8042. Node: _go32_dpmi_allocate_dos_memory
  8043. 87587
  8044. Node: _go32_dpmi_allocate_iret_wrapper
  8045. 88803
  8046. Node: _go32_dpmi_allocate_real_mode_callback_iret
  8047. 90012
  8048. Node: _go32_dpmi_allocate_real_mode_callback_retf
  8049. 91768
  8050. Node: _go32_dpmi_chain_protected_mode_interrupt_vector
  8051. 92971
  8052. Node: _go32_dpmi_free_dos_memory
  8053. 93983
  8054. Node: _go32_dpmi_free_iret_wrapper
  8055. 94760
  8056. Node: _go32_dpmi_free_real_mode_callback
  8057. 95421
  8058. Node: _go32_dpmi_get_free_memory_information
  8059. 96139
  8060. Node: _go32_dpmi_get_protected_mode_interrupt_vector
  8061. 97450
  8062. Node: _go32_dpmi_get_real_mode_interrupt_vector
  8063. 98328
  8064. Node: _go32_dpmi_remaining_physical_memory
  8065. 99068
  8066. Node: _go32_dpmi_remaining_virtual_memory
  8067. 99576
  8068. Node: _go32_dpmi_resize_dos_memory
  8069. 100067
  8070. Node: _go32_dpmi_set_protected_mode_interrupt_vector
  8071. 101033
  8072. Node: _go32_dpmi_set_real_mode_interrupt_vector
  8073. 102944
  8074. Node: _go32_dpmi_simulate_fcall
  8075. 103676
  8076. Node: _go32_dpmi_simulate_fcall_iret
  8077. 104689
  8078. Node: _go32_dpmi_simulate_int
  8079. 105708
  8080. Node: _go32_info_block
  8081. 106733
  8082. Node: _go32_my_cs
  8083. 109645
  8084. Node: _go32_my_ds
  8085. 109997
  8086. Node: _go32_my_ss
  8087. 110345
  8088. Node: _go32_want_ctrl_break
  8089. 110703
  8090. Node: _go32_was_ctrl_break_hit
  8091. 111615
  8092. Node: hasmntopt
  8093. 112398
  8094. Node: htonl
  8095. 112837
  8096. Node: htons
  8097. 113300
  8098. Node: index
  8099. 113756
  8100. Node: initstate
  8101. 114315
  8102. Node: insque
  8103. 114796
  8104. Node: int86
  8105. 115341
  8106. Node: int86x
  8107. 115858
  8108. Node: intdos
  8109. 117180
  8110. Node: intdosx
  8111. 117598
  8112. Node: _iob
  8113. 117971
  8114. Node: isalnum
  8115. 118169
  8116. Node: isalpha
  8117. 118499
  8118. Node: isatty
  8119. 118794
  8120. Node: iscntrl
  8121. 119214
  8122. Node: isdigit
  8123. 119531
  8124. Node: isgraph
  8125. 119825
  8126. Node: islower
  8127. 120185
  8128. Node: isprint
  8129. 120492
  8130. Node: ispunct
  8131. 120848
  8132. Node: isspace
  8133. 121207
  8134. Node: isupper
  8135. 121582
  8136. Node: isxdigit
  8137. 121903
  8138. Node: kbhit
  8139. 122258
  8140. Node: kill
  8141. 122737
  8142. Node: labs
  8143. 122934
  8144. Node: ldexp
  8145. 123217
  8146. Node: ldiv
  8147. 123522
  8148. Node: link
  8149. 124102
  8150. Node: localtime
  8151. 124603
  8152. Node: lock
  8153. 125032
  8154. Node: longjmp
  8155. 125804
  8156. Node: longjmperror
  8157. 126583
  8158. Node: lseek
  8159. 126915
  8160. Node: __main
  8161. 127627
  8162. Node: malloc
  8163. 127874
  8164. Node: memccpy
  8165. 128458
  8166. Node: memchr
  8167. 128981
  8168. Node: memcmp
  8169. 129446
  8170. Node: _memcpy
  8171. 129854
  8172. Node: memcpy
  8173. 130463
  8174. Node: memmove
  8175. 130846
  8176. Node: memset
  8177. 131401
  8178. Node: mkdir
  8179. 131853
  8180. Node: mkfifo
  8181. 132278
  8182. Node: mknod
  8183. 132509
  8184. Node: mkstemp
  8185. 132740
  8186. Node: mktemp
  8187. 133487
  8188. Node: mktime
  8189. 134256
  8190. Node: modf
  8191. 134724
  8192. Node: morecore
  8193. 135229
  8194. Node: movedata
  8195. 135430
  8196. Node: nlist
  8197. 137090
  8198. Node: ntohl
  8199. 137349
  8200. Node: ntohs
  8201. 137805
  8202. Node: on_exit
  8203. 138260
  8204. Node: open
  8205. 138812
  8206. Node: opendir
  8207. 140488
  8208. Node: optarg
  8209. 141021
  8210. Node: opterr
  8211. 141168
  8212. Node: optind
  8213. 141314
  8214. Node: optopt
  8215. 141460
  8216. Node: pathconf
  8217. 141608
  8218. Node: pclose
  8219. 142550
  8220. Node: perror
  8221. 143126
  8222. Node: pipe
  8223. 143667
  8224. Node: popen
  8225. 143893
  8226. Node: printf
  8227. 145158
  8228. Node: putc
  8229. 148441
  8230. Node: putchar
  8231. 148830
  8232. Node: putenv
  8233. 149212
  8234. Node: puts
  8235. 149813
  8236. Node: putw
  8237. 150212
  8238. Node: qsort
  8239. 150684
  8240. Node: rand
  8241. 152156
  8242. Node: random
  8243. 152515
  8244. Node: rawclock
  8245. 152889
  8246. Node: read
  8247. 153289
  8248. Node: readcr
  8249. 153930
  8250. Node: readdir
  8251. 154427
  8252. Node: readv
  8253. 155183
  8254. Node: realloc
  8255. 155854
  8256. Node: realloc_srchlen
  8257. 156667
  8258. Node: remove
  8259. 157010
  8260. Node: remque
  8261. 157486
  8262. Node: rename
  8263. 157975
  8264. Node: rewind
  8265. 158503
  8266. Node: rewinddir
  8267. 158889
  8268. Node: rindex
  8269. 159335
  8270. Node: rmdir
  8271. 159924
  8272. Node: sbrk
  8273. 160333
  8274. Node: scanf
  8275. 161103
  8276. Node: seekdir
  8277. 164399
  8278. Node: setbuf
  8279. 165020
  8280. Node: setbuffer
  8281. 165811
  8282. Node: setcbrk
  8283. 166625
  8284. Node: setdate
  8285. 167002
  8286. Node: setdisk
  8287. 167379
  8288. Node: setenv
  8289. 167788
  8290. Node: setftime
  8291. 168367
  8292. Node: setgrent
  8293. 169104
  8294. Node: setjmp
  8295. 169448
  8296. Node: setlinebuf
  8297. 170228
  8298. Node: setmntent
  8299. 170891
  8300. Node: _setmode
  8301. 171372
  8302. Node: setmode
  8303. 171906
  8304. Node: setpwent
  8305. 172474
  8306. Node: _setstack
  8307. 172832
  8308. Node: setstate
  8309. 173070
  8310. Node: settime
  8311. 173474
  8312. Node: settimeofday
  8313. 173857
  8314. Node: setvbuf
  8315. 174318
  8316. Node: sigaction
  8317. 175376
  8318. Node: sigaddset
  8319. 175622
  8320. Node: sigdelset
  8321. 175870
  8322. Node: sigemptyset
  8323. 176120
  8324. Node: sigfillset
  8325. 176375
  8326. Node: sigismember
  8327. 176630
  8328. Node: signal
  8329. 176882
  8330. Node: sigsetmask
  8331. 177124
  8332. Node: sleep
  8333. 177368
  8334. Node: _smallbuf
  8335. 177773
  8336. Node: spawn*
  8337. 177958
  8338. Node: sprintf
  8339. 180577
  8340. Node: srand
  8341. 180954
  8342. Node: srandom
  8343. 181385
  8344. Node: sscanf
  8345. 181822
  8346. Node: stat
  8347. 182256
  8348. Node: stat_assist
  8349. 183595
  8350. Node: statfs
  8351. 183784
  8352. Node: _stklen
  8353. 184868
  8354. Node: strcasecmp
  8355. 185289
  8356. Node: strcat
  8357. 185772
  8358. Node: strchr
  8359. 186154
  8360. Node: strcmp
  8361. 186665
  8362. Node: strcoll
  8363. 187154
  8364. Node: strcpy
  8365. 187692
  8366. Node: strcspn
  8367. 188042
  8368. Node: strdup
  8369. 188659
  8370. Node: strerror
  8371. 189227
  8372. Node: strftime
  8373. 189709
  8374. Node: stricmp
  8375. 192310
  8376. Node: strlen
  8377. 192779
  8378. Node: strlwr
  8379. 193191
  8380. Node: strncasecmp
  8381. 193594
  8382. Node: strncat
  8383. 194173
  8384. Node: strncmp
  8385. 194574
  8386. Node: strncpy
  8387. 195107
  8388. Node: strnicmp
  8389. 195501
  8390. Node: strpbrk
  8391. 196066
  8392. Node: strrchr
  8393. 196548
  8394. Node: strsep
  8395. 197000
  8396. Node: strspn
  8397. 197889
  8398. Node: strstr
  8399. 198496
  8400. Node: strtod
  8401. 198927
  8402. Node: strtok
  8403. 199460
  8404. Node: strtol
  8405. 200257
  8406. Node: strtoul
  8407. 201152
  8408. Node: strupr
  8409. 201672
  8410. Node: strxfrm
  8411. 202056
  8412. Node: swab
  8413. 202652
  8414. Node: sync
  8415. 203037
  8416. Node: sys_errlist
  8417. 203267
  8418. Node: sys_nerr
  8419. 203640
  8420. Node: sysconf
  8421. 204039
  8422. Node: system
  8423. 206052
  8424. Node: tell
  8425. 206739
  8426. Node: telldir
  8427. 207076
  8428. Node: tempnam
  8429. 207612
  8430. Node: time
  8431. 208254
  8432. Node: timezone
  8433. 208626
  8434. Node: tmpfile
  8435. 209247
  8436. Node: tmpnam
  8437. 209646
  8438. Node: tolower
  8439. 210072
  8440. Node: toupper
  8441. 210499
  8442. Node: truncate
  8443. 210927
  8444. Node: ttyname
  8445. 211334
  8446. Node: tzname
  8447. 211727
  8448. Node: tzset
  8449. 212036
  8450. Node: tzsetwall
  8451. 212321
  8452. Node: _tztab
  8453. 212624
  8454. Node: umask
  8455. 212814
  8456. Node: ungetc
  8457. 213019
  8458. Node: unlink
  8459. 213480
  8460. Node: unlock
  8461. 213851
  8462. Node: unsetenv
  8463. 214203
  8464. Node: usleep
  8465. 214575
  8466. Node: utime
  8467. 214962
  8468. Node: utimes
  8469. 215601
  8470. Node: valloc
  8471. 215952
  8472. Node: vfork
  8473. 216469
  8474. Node: vfprintf
  8475. 216715
  8476. Node: vprintf
  8477. 217126
  8478. Node: vsprintf
  8479. 217525
  8480. Node: wait
  8481. 217939
  8482. Node: write
  8483. 218167
  8484. Node: writecr
  8485. 218816
  8486. Node: writev
  8487. 219374
  8488. Node: xmalloc
  8489. 219756
  8490. Node: xrealloc
  8491. 220189
  8492. Node: Index
  8493. 220695
  8494. End Tag Table
  8495.